From: W. Felix Handte Date: Tue, 18 Aug 2020 17:30:41 +0000 (-0400) Subject: Prefetch First Batch of Match Positions; +11% Speed in Level 5 w/ 1 Dict X-Git-Tag: v1.4.7~81^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e91ae27ebdbdde0abb8ef7dcb50cd88e37897f5;p=thirdparty%2Fzstd.git Prefetch First Batch of Match Positions; +11% Speed in Level 5 w/ 1 Dict --- diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c index 5e38e49cc..30330a12c 100644 --- a/lib/compress/zstd_lazy.c +++ b/lib/compress/zstd_lazy.c @@ -574,8 +574,7 @@ size_t ZSTD_HcFindBestMatch_generic ( const U32 ddsIndexDelta = dictLimit - ddsSize; const U32 ddsMinChain = ddsSize > ddsChainSize ? ddsSize - ddsChainSize : 0; const U32 bucketSize = (1 << DD_BLOG); - - U32 attemptNb = 1; + U32 attemptNb; matchIndex = dms->hashTable[ddsIdx]; @@ -583,7 +582,11 @@ size_t ZSTD_HcFindBestMatch_generic ( if (!matchIndex) return ml; - for ( ; (matchIndex>ddsLowestIndex) & (nbAttempts>0) ; nbAttempts--, attemptNb++) { + for (attemptNb = 0; attemptNb < bucketSize; attemptNb++) { + PREFETCH_L1(ddsBase + dms->hashTable[ddsIdx + attemptNb]); + } + + for (attemptNb = 1; (matchIndex>ddsLowestIndex) & (nbAttempts>0) ; nbAttempts--, attemptNb++) { size_t currentMl=0; const BYTE* const match = ddsBase + matchIndex; assert(match+4 <= ddsEnd);