]> git.ipfire.org Git - thirdparty/zlib-ng.git/commit
Speed up deflation for level 0 (storing).
authorMark Adler <madler@alumni.caltech.edu>
Sat, 5 Nov 2016 15:43:29 +0000 (08:43 -0700)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 6 Feb 2017 11:40:06 +0000 (12:40 +0100)
commit40039a039c26da37cdc972aa650a9ea40e310f20
tree63d5bbdfcc02adfca7dfe1c357fe1b67a2e826b1
parente84a42f7a34c7f8728d669a747d149907ec9818c
Speed up deflation for level 0 (storing).

The previous code slid the window and the hash table and copied
every input byte three times in order to just write the data as
stored blocks with no compression. This commit minimizes sliding
and copying, especially for large input and output buffers.

Level 0 compression is now more than 20 times faster than before
the commit.

Most of the speedup is due to deferring hash table slides until
deflateParams() is called to change the compression level away
from 0. More speedup is due to copying directly from next_in to
next_out when the amounts of available input data and output space
permit it, avoiding the intermediate pending buffer. Additionally,
only the last 32K of the used input data is copied back to the
sliding window when large input buffers are provided.
deflate.c
deflate_p.h