• Joe Tsai's avatar
    compress/flate: simplify inflate logic · 5c78589b
    Joe Tsai authored
    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/14181Reviewed-by: 's avatarNigel Tao <nigeltao@golang.org>
    5c78589b
inflate.go 19.7 KB