]> Cypherpunks repositories - gostls13.git/commit
sync: add Pool benchmarks to stress STW and reuse
authorAustin Clements <austin@google.com>
Fri, 8 Mar 2019 20:01:34 +0000 (15:01 -0500)
committerAustin Clements <austin@google.com>
Fri, 5 Apr 2019 18:49:06 +0000 (18:49 +0000)
commit59f2704dabf0c68bc645adb0ed4a8d94cdbcd7bb
tree31438edb7add53aa45120e515f2e5a08f5a69dc6
parent57bb7be4b171a0c7ebf80467306c91e5ed8b2e84
sync: add Pool benchmarks to stress STW and reuse

This adds two benchmarks that will highlight two problems in Pool that
we're about to address.

The first benchmark measures the impact of large Pools on GC STW time.
Currently, STW time is O(# of items in Pools), and this benchmark
demonstrates 70µs STW times.

The second benchmark measures the impact of fully clearing all Pools
on each GC. Typically this is a problem in heavily-loaded systems
because it causes a spike in allocation. This benchmark stresses this
by simulating an expensive "New" function, so the cost of creating new
objects is reflected in the ns/op of the benchmark.

For #22950, #22331.

Change-Id: I0c8853190d23144026fa11837b6bf42adc461722
Reviewed-on: https://go-review.googlesource.com/c/go/+/166959
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/sync/pool_test.go