diff options
| author | Mateusz Poliwczak <mpoliwczak34@gmail.com> | 2025-09-26 20:47:45 +0200 |
|---|---|---|
| committer | Mateusz Poliwczak <mpoliwczak34@gmail.com> | 2026-03-02 10:41:43 -0800 |
| commit | 094aacdb047e716ea5598514222bc8c70843d49e (patch) | |
| tree | 5a961a5159a457d0c7f9c867d49ca8780f1aa069 /src/runtime | |
| parent | a6a4a41e225096a2599762d95af9c32d944a15e2 (diff) | |
| download | go-094aacdb047e716ea5598514222bc8c70843d49e.tar.xz | |
reflect: outlilne []runtimeSelect allocation in Select
With CL 707255 doing so we don't cause heap alloaction of the sllice,
instead it is stored on the stack.
goos: linux
goarch: amd64
pkg: reflect
cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
│ /tmp/before │ /tmp/after │
│ sec/op │ sec/op vs base │
Select/1-8 41.66n ± 1% 41.89n ± 0% ~ (p=0.151 n=20)
Select/4-8 149.3n ± 1% 149.1n ± 8% ~ (p=0.324 n=20)
Select/8-8 355.0n ± 1% 358.1n ± 1% +0.87% (p=0.002 n=20)
SelectStaticLit/[4]SelectCase-8 153.3n ± 0% 151.9n ± 1% -0.88% (p=0.005 n=20)
SelectStaticLit/[8]SelectCase-8 363.1n ± 1% 299.9n ± 0% -17.42% (p=0.000 n=20)
geomean 165.2n 159.1n -3.69%
│ /tmp/before │ /tmp/after │
│ B/op │ B/op vs base │
Select/1-8 8.000 ± 0% 8.000 ± 0% ~ (p=1.000 n=20) ¹
Select/4-8 96.00 ± 0% 96.00 ± 0% ~ (p=1.000 n=20) ¹
Select/8-8 512.0 ± 0% 512.0 ± 0% ~ (p=1.000 n=20) ¹
SelectStaticLit/[4]SelectCase-8 96.00 ± 0% 96.00 ± 0% ~ (p=1.000 n=20) ¹
SelectStaticLit/[8]SelectCase-8 512.0 ± 0% 256.0 ± 0% -50.00% (p=0.000 n=20)
geomean 114.1 99.32 -12.94%
¹ all samples are equal
│ /tmp/before │ /tmp/after │
│ allocs/op │ allocs/op vs base │
Select/1-8 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=20) ¹
Select/4-8 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=20) ¹
Select/8-8 11.00 ± 0% 11.00 ± 0% ~ (p=1.000 n=20) ¹
SelectStaticLit/[4]SelectCase-8 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=20) ¹
SelectStaticLit/[8]SelectCase-8 11.00 ± 0% 10.00 ± 0% -9.09% (p=0.000 n=20)
geomean 4.968 4.874 -1.89%
Updates #75620
Change-Id: I6a6a696492a4c07d8a3c03de0a36edbf400af506
Reviewed-on: https://go-review.googlesource.com/c/go/+/707275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/runtime')
0 files changed, 0 insertions, 0 deletions
