• Robert Griesemer's avatar
    math/bits: much faster ReverseBytes, added respective benchmarks · ddb15cea
    Robert Griesemer authored
    Measured on 2.3 GHz Intel Core i7, running maxOS 10.12.3.
    
    benchmark                     old ns/op     new ns/op     delta
    BenchmarkReverseBytes-8       11.4          3.51          -69.21%
    BenchmarkReverseBytes16-8     6.87          0.64          -90.68%
    BenchmarkReverseBytes32-8     7.79          0.65          -91.66%
    BenchmarkReverseBytes64-8     11.6          0.64          -94.48%
    
    name              old time/op  new time/op  delta
    ReverseBytes-8    11.4ns ± 0%   3.5ns ± 0%   ~     (p=1.000 n=1+1)
    ReverseBytes16-8  6.87ns ± 0%  0.64ns ± 0%   ~     (p=1.000 n=1+1)
    ReverseBytes32-8  7.79ns ± 0%  0.65ns ± 0%   ~     (p=1.000 n=1+1)
    ReverseBytes64-8  11.6ns ± 0%   0.6ns ± 0%   ~     (p=1.000 n=1+1)
    
    Change-Id: I67b529652b3b613c61687e9e185e8d4ee40c51a2
    Reviewed-on: https://go-review.googlesource.com/37211
    Run-TryBot: Robert Griesemer <gri@golang.org>
    Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
    ddb15cea
bits_test.go 12.3 KB