7 Commits

Author SHA1 Message Date
Eric Biggers
740820bd66 programs: define begin_program()
In preparation for testing freestanding library builds, make all
programs call a function begin_program().
2020-04-17 21:28:49 -07:00
Eric Biggers
0015560a82 test_slow_decompression: skip by default since it's flaky
Since this is a performance-based test, unfortunately it's always going
to be flaky, so it needs to be skipped by default.
2019-08-30 00:14:43 -05:00
Eric Biggers
2bdbe040fe test_slow_decompression: make less flaky 2019-08-11 17:36:09 -07:00
Eric Biggers
c398e237b6 programs: move output_bitstream to test_util 2018-12-28 10:25:44 -06:00
Eric Biggers
ce6a95f47b programs: add test_util
Move program utility functions that are used only by "test programs"
(i.e. not by gzip/gunzip) from prog_util.{c,h} into test_util.{c,h}.
This reduces the code that is compiled for the default build target,
which excludes the test programs.
2018-12-28 10:25:44 -06:00
Eric Biggers
a64bd1e830 lib/deflate_decompress: optimize build_decode_table() via table doubling
Another build_decode_table() optimization: rather than filling all the
entries for each codeword using strided stores, just fill one initially
and fill the rest by memcpy()s as the table is incrementally expanded.

Also make some other cleanups and small optimizations.
2018-12-27 17:10:23 -06:00
Eric Biggers
57cab078f1 lib: optimize decompressing repeated static Huffman blocks
Improve libdeflate's worst-case performance decompressing malicious
DEFLATE streams by about 14x, bringing it within a factor of about 2x of
zlib, by skipping rebuilding the decode tables for the static Huffman
codes when they're already loaded into the decompressor.

This improves performance decompressing a stream of all empty static
Huffman blocks from about 0.36 MB/s to 175 MB/s, or the original
reproducer given on the Github issue from about 3.3 MB/s to 219 MB/s.
A regression test is added for these cases as well as the empty dynamic
Huffman blocks case to verify worst-case performance comparable to zlib.

Resolves https://github.com/ebiggers/libdeflate/issues/33
2018-12-23 12:03:00 -06:00