]> Cypherpunks repositories - gostls13.git/commit
sync: use atomic.Uint64 for WaitGroup state
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 18 Aug 2022 17:31:07 +0000 (00:31 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 19 Aug 2022 01:34:22 +0000 (01:34 +0000)
commitee833ed72e8ccfdd2193b0e6c0223ee8eb99b380
tree4048caab7ba0c90ff51310982b311481b701f0cc
parente51b3ae0eebfacd15cad9216b8dd2d2597b860c5
sync: use atomic.Uint64 for WaitGroup state

So it's guaranteed to have 64-bit alignment, simplify the code without
losing any performance:

name                     old time/op    new time/op    delta
WaitGroupUncontended-8     3.84ns ± 2%    3.82ns ± 1%   ~     (p=0.159 n=10+10)
WaitGroupAddDone-8         33.2ns ± 3%    33.0ns ± 3%   ~     (p=0.564 n=9+10)
WaitGroupAddDoneWork-8     39.3ns ± 1%    39.3ns ± 1%   ~     (p=1.000 n=8+9)
WaitGroupWait-8            0.70ns ± 3%    0.70ns ± 2%   ~     (p=0.720 n=9+10)
WaitGroupWaitWork-8        7.93ns ± 1%    7.99ns ± 3%   ~     (p=0.271 n=10+10)
WaitGroupActuallyWait-8     135ns ± 2%     135ns ± 1%   ~     (p=0.897 n=10+10)

Change-Id: I446b53fa92873419aadd592f45e51398f8ad8652
Reviewed-on: https://go-review.googlesource.com/c/go/+/424835
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/sync/waitgroup.go