• Michael Munday's avatar
    math: fix Abs, Copysign and Signbit benchmarks · ffb4708d
    Michael Munday authored
    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: 's avatarIan Lance Taylor <iant@golang.org>
    ffb4708d
all_test.go 75.9 KB