Skip to content

Commit

Permalink
Change benchmark to measure Worker() and Stop()
Browse files Browse the repository at this point in the history
This benchmark was written when the creation of goroutines was
synchronous, that's not the case anymore so in order to measure
_something_ we'll measure a worker acquire and Stop.
  • Loading branch information
colega committed Jul 16, 2020
1 parent 3d67e08 commit fd4282d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions runner_pool_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ func BenchmarkCreatePool(b *testing.B) {
for i := 0; i < b.N; i++ {
cfg := Config{Workers: n}
pool := New(cfg, goRunner)
err := pool.Start()
_ = err
b.StopTimer()
_ = pool.Start()
w, err := pool.Worker(context.Background())
if err != nil {
panic(err)
}
w.Release()

_ = pool.Stop(context.Background())
b.StartTimer()
}
})
}
Expand Down

0 comments on commit fd4282d

Please sign in to comment.