• Matt T. Proud's avatar
    expvar: swap Float sync. from mutex to atomic. · 926616da
    Matt T. Proud authored
    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/3687Reviewed-by: 's avatarRob Pike <r@golang.org>
    926616da
expvar.go 6.6 KB