]> Cypherpunks repositories - gostls13.git/commit
runtime: move pinned object out of inner loop for benchmarks
authorMichael Anthony Knyszek <mknyszek@google.com>
Tue, 23 May 2023 21:02:36 +0000 (21:02 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 24 May 2023 16:22:30 +0000 (16:22 +0000)
commit5d68121628afe73ea093bb46dac45f71f92eecac
tree84c8960cac71ec89042c3cae42af0c78b5a2a3fd
parentac17bb6f13979f2ab9fcd45f0758b43ed72d0973
runtime: move pinned object out of inner loop for benchmarks

In theory by allocating new objects every time, the benchmark is
including the performance of allocating new pinner bits for a span. In
practice however, most of the time each span already does have pinner
bits allocated (it's still a rare operation).

We can get a better sense of the raw cost of pinning an object (minus
pinner bits allocation) by moving the object allocation out of the inner
loop.

Change-Id: I2869fa6c3f353b726fe8440d2e6b7f89902f9364
Reviewed-on: https://go-review.googlesource.com/c/go/+/497620
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
src/runtime/pinner_test.go