diff options
| author | Keith Randall <khr@golang.org> | 2024-11-08 15:48:33 -0800 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2024-11-18 18:27:41 +0000 |
| commit | bcdaac63965473ce315681a7af7e169b741a01e1 (patch) | |
| tree | 3921a6cc50f342ae9966629335f7a7d83e05a7e4 /test/fixedbugs/bug385_64.go | |
| parent | 7a20239ce8a877ae82b8c269a8ff28fe59609c69 (diff) | |
| download | go-bcdaac63965473ce315681a7af7e169b741a01e1.tar.xz | |
runtime: fix MapCycle test
It wasn't actually testing what it says it was testing.
A random permutation isn't cyclic. It only probably hits a few
elements before entering a cycle.
Use an algorithm that generates a random cyclic permutation instead.
Fixing the test makes the previous CL look less good. But it still helps.
(Theory: Fixing the test makes it less cache friendly, so there are
more misses all around. That makes the benchmark slower, suppressing
the differences seen. Also fixing the benchmark makes the loop
iteration count less predictable, which hurts the raw loop
implementation somewhat.)
(baseline = tip, experiment = tip+previous CL, noswiss = GOEXPERIMENT=noswissmap)
goos: darwin
goarch: arm64
pkg: runtime
cpu: Apple M2 Ultra
│ baseline │ experiment │
│ sec/op │ sec/op vs base │
MapCycle-24 20.59n ± 4% 18.99n ± 3% -7.77% (p=0.000 n=10)
khr@Mac-Studio src % benchstat noswiss experiment
goos: darwin
goarch: arm64
pkg: runtime
cpu: Apple M2 Ultra
│ noswiss │ experiment │
│ sec/op │ sec/op vs base │
MapCycle-24 16.12n ± 1% 18.99n ± 3% +17.83% (p=0.000 n=10)
Change-Id: I3a4edb814ba97fec020a6698c535ce3a87a9fc67
Reviewed-on: https://go-review.googlesource.com/c/go/+/625900
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'test/fixedbugs/bug385_64.go')
0 files changed, 0 insertions, 0 deletions
