(b *testing.B)
| 125 | } |
| 126 | |
| 127 | func BenchmarkPool(b *testing.B) { |
| 128 | b.Run("startup and teardown", func(b *testing.B) { |
| 129 | for i := 0; i < b.N; i++ { |
| 130 | p := New() |
| 131 | p.Go(func() {}) |
| 132 | p.Wait() |
| 133 | } |
| 134 | }) |
| 135 | |
| 136 | b.Run("per task", func(b *testing.B) { |
| 137 | p := New() |
| 138 | f := func() {} |
| 139 | for i := 0; i < b.N; i++ { |
| 140 | p.Go(f) |
| 141 | } |
| 142 | p.Wait() |
| 143 | }) |
| 144 | } |