3 ms·
If you can, you should upgrade from DEFLATE (the compression format in zlib, gzip, zip files, png, office docs, etc) to something more modern like zstd. If you
by wolf550e 9y ago
If you can, you should upgrade from DEFLATE (the compression format in zlib, gzip, zip files, png, office docs, etc) to something more modern like zstd.
If you must preserve ability to decompress by zlib, there are different implementations of a DEFLATE compressor that are better than zlib (either faster or better compression ratio).
A DEFLATE compressor needs to keep a data structure that is able to answer the query "where in the last 32,768 bytes of input there are occurrences of the exact 3 bytes I'm looking at? If possible, check whether the 4th byte matches too and find the longest match. Among matches equally long, prefer those which are closer". For a 32KB window, a data structure that always finds the best match is not large, unless you're on a microcontroller. The size of the data structure becomes a problem when the window is large.