]> Cypherpunks repositories - gostls13.git/commit
math: protect benchmarked functions from being optimized away
authorMartin Möhrmann <moehrmann@google.com>
Sat, 18 Feb 2017 08:32:46 +0000 (09:32 +0100)
committerMartin Möhrmann <moehrmann@google.com>
Sat, 18 Feb 2017 17:00:59 +0000 (17:00 +0000)
commit6cfc3b25e95d9f41215e0df8eadfdbeb472594fe
treec80e5b5f967591c54ce62301c394518301b66def
parent6ef92b6e3bce369feeb114dd3267a3f18038fc8c
math: protect benchmarked functions from being optimized away

Add exported global variables and store the results of benchmarked
functions in them. This prevents the current compiler optimizations
from removing the instructions that are needed to compute the return
values of the benchmarked functions.

Change-Id: If8b08424e85f3796bb6dd73e761c653abbabcc5e
Reviewed-on: https://go-review.googlesource.com/37195
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/math/all_test.go