]> git.ipfire.org Git - thirdparty/zstd.git/commit
ZSTD_fast_noDict: Minimize Checks When Writing Hash Table for ip1
authorW. Felix Handte <w@felixhandte.com>
Tue, 10 May 2022 21:29:39 +0000 (14:29 -0700)
committerW. Felix Handte <w@felixhandte.com>
Tue, 10 May 2022 21:29:39 +0000 (14:29 -0700)
commit040986a4f4a2ba64a3ad9dc76646d8fab4472b37
treef823f4644881ed164c715350db77e21ea48c5cf0
parent8bf32de8507c7fa9ebc9207ac50401a194fb7564
ZSTD_fast_noDict: Minimize Checks When Writing Hash Table for ip1

This commit avoids checking whether a hashtable write is safe in two of the
three match-found paths in `ZSTD_compressBlock_fast_noDict_generic`. This pro-
duces a ~0.5% speed-up in compression.

A comment in the code describes why we can skip this check in the other two
paths (the repcode check and the first match check in the unrolled loop).

A downside is that in the new position where we make this check, we have not
yet computed `mLength`. We therefore have to avoid writing *possibly* dangerous
positions, rather than the old check which only avoids writing *actually*
dangerous positions. This leads to a miniscule loss in ratio (remember that
this scenario can only been triggered in very negative levels or under incomp-
ressibility acceleration).
lib/compress/zstd_fast.c