(b *testing.B)
| 81 | } |
| 82 | |
| 83 | func Benchmark_Reduce_Parallel(b *testing.B) { |
| 84 | for i := 0; i < b.N; i++ { |
| 85 | b.StopTimer() |
| 86 | obs := Range(0, benchNumberOfElementsSmall, WithBufferedChannel(benchChannelCap)). |
| 87 | Reduce(func(_ context.Context, acc, elem interface{}) (interface{}, error) { |
| 88 | // Simulate a blocking IO call |
| 89 | time.Sleep(5 * time.Millisecond) |
| 90 | if a, ok := acc.(int); ok { |
| 91 | if b, ok := elem.(int); ok { |
| 92 | return a + b, nil |
| 93 | } |
| 94 | } else { |
| 95 | return elem.(int), nil |
| 96 | } |
| 97 | return 0, errFoo |
| 98 | }, WithPool(ioPool)) |
| 99 | b.StartTimer() |
| 100 | <-obs.Run() |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | func Benchmark_Map_Sequential(b *testing.B) { |
| 105 | for i := 0; i < b.N; i++ { |
nothing calls this directly
no test coverage detected
searching dependent graphs…