1
0
mirror of https://github.com/golang/go synced 2024-11-19 21:24:40 -07:00
go/src/compress/bzip2
Ilya Tocar 9eb219480e compress/bzip2: remove bit-tricks
Since compiler is now able to generate conditional moves, we can replace
bit-tricks with simple if/else. This even results in slightly better performance:

name            old time/op    new time/op    delta
DecodeDigits-6    13.4ms ± 4%    13.0ms ± 2%  -2.63%  (p=0.003 n=10+10)
DecodeTwain-6     37.5ms ± 1%    36.3ms ± 1%  -3.03%  (p=0.000 n=10+9)
DecodeRand-6      4.23ms ± 1%    4.07ms ± 1%  -3.67%  (p=0.000 n=10+9)

name            old speed      new speed      delta
DecodeDigits-6  7.47MB/s ± 4%  7.67MB/s ± 2%  +2.69%  (p=0.002 n=10+10)
DecodeTwain-6   10.4MB/s ± 1%  10.7MB/s ± 1%  +3.25%  (p=0.000 n=10+8)
DecodeRand-6    3.87MB/s ± 1%  4.03MB/s ± 2%  +4.08%  (p=0.000 n=10+10)
diff --git a/src/compress/bzip2/huffman.go b/src/compress/bzip2/huffman.go

Change-Id: Ie96ef1a9e07013b07e78f22cdccd531f3341caca
Reviewed-on: https://go-review.googlesource.com/102015
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: Joe Tsai <joetsai@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-21 21:57:15 +00:00
..
testdata
bit_reader.go
bzip2_test.go compress/bzip2: fix checksum mismatch on empty reads 2017-09-25 23:05:58 +00:00
bzip2.go compress/bzip2: fix checksum mismatch on empty reads 2017-09-25 23:05:58 +00:00
huffman.go compress/bzip2: remove bit-tricks 2018-03-21 21:57:15 +00:00
move_to_front.go