diff options
| author | Carlo Alberto Ferraris <cafxx@strayorange.com> | 2021-10-14 16:50:41 +0900 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2021-10-19 18:21:38 +0000 |
| commit | ad7db1f90fb66f00f5b020360aabd9f27d1c764f (patch) | |
| tree | ecd9458f0c74412adba9c01dfd6e319aa65d55a5 /src/errors | |
| parent | 982060203c26b60fd74e4fa2fd967600c65ee7fc (diff) | |
| download | go-ad7db1f90fb66f00f5b020360aabd9f27d1c764f.tar.xz | |
sync: avoid a dynamic check in WaitGroup on 64-bit architectures
uint64 is guaranteed by the compiler to be aligned on 64-bit archs.
By using uint64+uint32 instead of [3]uint32 we can make use of the
guaranteed alignment to avoid the run-time alignment check.
On linux/amd64:
name old time/op new time/op delta
WaitGroupUncontended-4 8.84ns ± 3% 7.62ns ± 4% -13.72% (p=0.000 n=17+18)
WaitGroupAddDone-4 66.8ns ± 3% 45.9ns ± 2% -31.31% (p=0.000 n=20+18)
WaitGroupAddDoneWork-4 79.2ns ± 1% 56.6ns ± 1% -28.54% (p=0.000 n=17+20)
WaitGroupWait-4 2.83ns ± 2% 2.58ns ± 2% -9.05% (p=0.000 n=18+20)
WaitGroupWaitWork-4 16.8ns ± 6% 16.5ns ± 6% ~ (p=0.072 n=20+18)
WaitGroupActuallyWait-4 263ns ± 2% 261ns ± 5% ~ (p=0.063 n=18+20)
Change-Id: I314340f2ed8a47d8b9c15f8a3b07e41f252f4831
Reviewed-on: https://go-review.googlesource.com/c/go/+/189837
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/errors')
0 files changed, 0 insertions, 0 deletions
