]> Cypherpunks.ru repositories - gostls13.git/commit
expvar: swap Float sync. from mutex to atomic.
authorMatt T. Proud <matt.proud@gmail.com>
Mon, 2 Feb 2015 08:33:44 +0000 (00:33 -0800)
committerRob Pike <r@golang.org>
Sun, 12 Apr 2015 23:07:50 +0000 (23:07 +0000)
commit926616da3f3781f5f71dacac429c6957dec83a65
tree42a35dc0c3dc7d1e20e58ea2840ee7e5ce98843a
parentae740a459ef40f63d3a2864b70c89e316efd0c8b
expvar: swap Float sync. from mutex to atomic.

Float type from a mutex to atomic bit array in a manner akin to
Google Guava's AtomicDouble[0], including adding a benchmark for the
type (benchcmp included below) along with some expvar_test.go cruft
being fixed.

benchmark             old ns/op     new ns/op     delta
BenchmarkFloatSet     115           9.37          -91.85%
BenchmarkFloatAdd     114           17.1          -85.00%

benchmark             old allocs     new allocs     delta
BenchmarkFloatSet     0              0              +0.00%
BenchmarkFloatAdd     0              0              +0.00%

benchmark             old bytes     new bytes     delta
BenchmarkFloatSet     0             0             +0.00%
BenchmarkFloatAdd     0             0             +0.00%

[0] - http://goo.gl/m4dtlI

Change-Id: I4ce6a913734ec692e3ed243f6e6f7c11da4c6036
Reviewed-on: https://go-review.googlesource.com/3687
Reviewed-by: Rob Pike <r@golang.org>
src/expvar/expvar.go
src/expvar/expvar_test.go