]> git.ipfire.org Git - thirdparty/zstd.git/commit
fix performance issue in scenario #2966 (part 1)
authorYann Collet <cyan@fb.com>
Fri, 31 Dec 2021 21:03:12 +0000 (13:03 -0800)
committerYann Collet <cyan@fb.com>
Fri, 31 Dec 2021 23:16:19 +0000 (15:16 -0800)
commit8c53e526db3bcf5a95f67bd347e1f89c79f4fe94
treecd26c5b18ba4150b3d0ef613f8e3232c4d5b8124
parent6211bfee5ec24dc825c11751c33aa31d618b5f10
fix performance issue in scenario #2966 (part 1)

When re-using a compression state, across multiple successive compressions,
the state should minimize the amount of allocation and initialization required.

This mostly matters in situations where initialization is an overwhelming task
compared to compression itself.
This can happen when the amount to compress is small,
while the compression state was given the impression that it would be much larger,
aka, streaming mode without providing a srcSize hint.

This lean-initialization optimization was broken in 980f3bbf8354edec0ad32b4430800f330185de6a .

This commit fixes it, making this scenario once again on par with v1.4.9.

Note that this does not completely fix #2966,
since another heavy initialization, specific to row mode,
is also happening (and was not present in v1.4.9).
This will be fixed in a separate commit.
lib/compress/zstd_cwksp.h