]> Cypherpunks repositories - gostls13.git/commit
compress/flate: simplify inflate logic
authorJoe Tsai <joetsai@digital-static.net>
Wed, 2 Sep 2015 06:42:43 +0000 (23:42 -0700)
committerNigel Tao <nigeltao@golang.org>
Thu, 3 Sep 2015 01:54:35 +0000 (01:54 +0000)
commit5c78589b69c87f25a4792d9c8a1446294c07600e
tree02f1b85aaaf9d22b5de68cb4af44ad84096c0eb5
parent9f0baca5054c8039d763f6a4d71d4508e896d546
compress/flate: simplify inflate logic

The flate library contains generator code, which is used to generate
the fixed huffman table. This is done so that fixed blocks can be
processed quicker since there is no need generate the decoder table
for fixed codes.

Instead, delete the precomputed table, and use sync.Once to generate
it at runtime when used.

Advantages:
* Reduces duplicated logic in flate package
* Reduces binary size by approximately 2KiB

Disadvantages:
* For the simplest possible program that simply decodes the fixed
block "\x03\x00" once, the modified code takes 4.7% longer for the
first decode. Compression performance for subsequent blocks afterwards
has no noticeable slow down.

Change-Id: I8f351218debf7d732118808859eda481b01011f6
Reviewed-on: https://go-review.googlesource.com/14181
Reviewed-by: Nigel Tao <nigeltao@golang.org>
src/compress/flate/fixedhuff.go [deleted file]
src/compress/flate/gen.go [deleted file]
src/compress/flate/inflate.go