]> Cypherpunks repositories - gostls13.git/commit
bzip2: improve performance
authorJeff R. Allen <jra@nella.org>
Mon, 18 Aug 2014 21:41:28 +0000 (14:41 -0700)
committerAdam Langley <agl@golang.org>
Mon, 18 Aug 2014 21:41:28 +0000 (14:41 -0700)
commit6d248cec56dd56f3ddb92bd587b5c4ac2f9919b1
treee10fb06221c09d538f1878cb12294faab946e172
parent523aa932881e72ccc83f25d441b2e535c1048296
bzip2: improve performance

Improve performance of move-to-front by using cache-friendly
copies instead of doubly-linked list. Simplify so that the
underlying slice is the object. Remove the n=0 special case,
      which was actually slower with the copy approach.

benchmark                 old ns/op     new ns/op     delta
BenchmarkDecodeDigits     26429714      23859699      -9.72%
BenchmarkDecodeTwain      76684510      67591946      -11.86%

benchmark                 old MB/s     new MB/s     speedup
BenchmarkDecodeDigits     1.63         1.81         1.11x
BenchmarkDecodeTwain      1.63         1.85         1.13x

Updates #6754.

LGTM=adg, agl, josharian
R=adg, agl, josharian
CC=golang-codereviews
https://golang.org/cl/131840043
src/pkg/compress/bzip2/bzip2_test.go
src/pkg/compress/bzip2/move_to_front.go