(b *testing.B)
| 208 | } |
| 209 | |
| 210 | func BenchmarkChainStreamInterceptor(b *testing.B) { |
| 211 | for _, n := range []int{1, 3, 5, 10} { |
| 212 | n := n |
| 213 | b.Run(strconv.Itoa(n), func(b *testing.B) { |
| 214 | interceptors := make([]StreamServerInterceptor, 0, n) |
| 215 | for i := 0; i < n; i++ { |
| 216 | interceptors = append(interceptors, func( |
| 217 | srv any, ss ServerStream, _ *StreamServerInfo, handler StreamHandler, |
| 218 | ) error { |
| 219 | return handler(srv, ss) |
| 220 | }) |
| 221 | } |
| 222 | |
| 223 | s := NewServer(ChainStreamInterceptor(interceptors...)) |
| 224 | b.ReportAllocs() |
| 225 | b.ResetTimer() |
| 226 | for i := 0; i < b.N; i++ { |
| 227 | if err := s.opts.streamInt(nil, nil, nil, func(any, ServerStream) error { |
| 228 | return nil |
| 229 | }); err != nil { |
| 230 | b.Fatal(err) |
| 231 | } |
| 232 | } |
| 233 | }) |
| 234 | } |
| 235 | } |
nothing calls this directly
no test coverage detected