]> Cypherpunks repositories - gostls13.git/commit
math: fix Abs, Copysign and Signbit benchmarks
authorMichael Munday <mike.munday@ibm.com>
Fri, 8 Sep 2017 23:22:29 +0000 (00:22 +0100)
committerMichael Munday <mike.munday@ibm.com>
Sat, 9 Sep 2017 16:52:16 +0000 (16:52 +0000)
commitffb4708d1bcf4a391ecf293b01695565c1b7cd04
tree348dd10d517b3c5e072df06d1d380fa750a24d09
parentd8ae2156fe08f31f9b20a79b6971638c5bf203b5
math: fix Abs, Copysign and Signbit benchmarks

CL 62250 makes constant folding a bit more aggressive and these
benchmarks were optimized away. This CL adds some indirection to
the function arguments to stop them being folded.

The Copysign benchmark is a bit faster because I've left one
argument as a constant and it can be partially folded.

                     old           CL 62250     this CL
Copysign             1.24ns ± 0%   0.34ns ± 2%  1.02ns ± 2%
Abs                  0.67ns ± 0%   0.35ns ± 3%  0.67ns ± 0%
Signbit              0.87ns ± 0%   0.35ns ± 2%  0.87ns ± 1%

Change-Id: I9604465a87d7aa29f4bd6009839c8ee354be3cd7
Reviewed-on: https://go-review.googlesource.com/62450
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/math/all_test.go