]> git.ipfire.org Git - thirdparty/zstd.git/commit
Don't shrink window log when streaming with a dictionary
authorNick Terrell <terrelln@fb.com>
Mon, 4 Jan 2021 21:43:47 +0000 (13:43 -0800)
committerNick Terrell <terrelln@fb.com>
Mon, 4 Jan 2021 23:54:09 +0000 (15:54 -0800)
commit9d31c704d569cd5bfed24d1f13c767c5e25d183d
tree1ea88320fcebe675b5715680bb7d63d175042a39
parenta98a6e2091a4d64df396216c2fbf695917a53e8c
Don't shrink window log when streaming with a dictionary

Fixes #2442.

1. When creating a dictionary keep the same behavior as before.
   Assume the source size is 513 bytes when adjusting parameters.
2. When calling ZSTD_getCParams() or ZSTD_adjustCParams() keep
   the same behavior as before.
3. When attaching a dictionary keep the same behavior of ignoring
   the dictionary size. When streaming this will select the
   largest parameters and not adjust them down. But, the CDict
   will use the correctly sized parameters, which seems like the
   right tradeoff.
4. When not attaching a dictionary (either forced not to, or
   using a prefix dictionary) we select parameters based on the
   dictionary size + source size, and assume the source size is
   small, which is the same behavior as before. But, now we don't
   adjust the window log (and hash and chain log) down when the
   source size is unknown.

When the source size is unknown all cdicts should attach, except
when the user disables attaching, or `forceWindow` is used. This
means that when streaming with a CDict we end up in the good case
where we get small CDict parameters, and large source parameters.

TODO: Add a streaming + dictionary regression test case.
lib/compress/zstd_compress.c
tests/regression/results.csv