This commit significantly improves the performance of length-limited
canonical Huffman code generation by introducing several optimizations
based on the 7-Zip implementation.
Altlhough Huffman code generation is not the main bottleneck of any of
the compression algorithms implemented here, an optimized implementation
can still improve overall performance by several percent. In addition,
it significantly speeds up LZMS decompression, which requires frequent
rebuilding of adaptive Huffman codes.
Some peformance comparisons:
- The average time taken to generate all three LZX codes (main,
length, and aligned offset) when compressing a Windows PE
filesystem with LZX decreased from 73.9 us to 17.3 us.
- The time taken to compress a Windows PE filesystem with LZX, using
the "fast" LZX algorithm (hash chain match finder and lazy
parsing), decreased from 12.3 s to 11.6 s (a 5.7% improvement).
- The time taken to decompress a Windows PE filesystem with LZMS,
using solid blocks, decreased from 12.3 s to 9.0 s (a 27%
improvement).