4 ms·
> I would apply zlib at maximum compression to N consecutive blocks, and then apply no compression to 100-N consecutive blocks Zlib is actually highly configur
by gopalv 9y ago
> I would apply zlib at maximum compression to N consecutive blocks, and then apply no compression to 100-N consecutive blocks
Zlib is actually highly configurable - it has a huge number of tweaks beyond just that one flag of size.
DEFAULT_STRATEGY is pretty much only one possible strategy.
You can tweak the LZ77, RLE and Huffman separately to get different compression performance (the levels correspond to different LZ77 lookups and deflate_fast vs deflate_slow).
In my work, I use different zlib strategies for different data (i.e already bit-packed integers vs raw strings), which works out pretty well.
My current complaint is that the Zlib algorithm doesn't quite detect record boundaries when building a dictionary, which is all only relevant to the compression algorithm, because the output is eventually just a DEFLATE stream (Zopfli is an example of an encoder only Zlib library).
Zstandard has a much wider set of options to use already built-in (fast, greedy, lazy, btlazy, btopt, btultra) etc.