]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
slightly nudge choices towards less sequences 1141/head
authorYann Collet <cyan@fb.com>
Fri, 25 May 2018 21:52:21 +0000 (14:52 -0700)
committerYann Collet <cyan@fb.com>
Fri, 25 May 2018 21:52:21 +0000 (14:52 -0700)
also slightly improve some strange detrimental corner cases.

lib/compress/zstd_opt.c

index 2a699c2ac937187f832da699df3f9e0bee6f28e9..e66019aa886762fe6d550b0aca028ed5b047510d 100644 (file)
@@ -282,6 +282,8 @@ ZSTD_getMatchPrice(U32 const offset,
         price += (ML_bits[mlCode] * BITCOST_MULTIPLIER) + (optPtr->matchLengthSumBasePrice - WEIGHT(optPtr->matchLengthFreq[mlCode], optLevel));
     }
 
+    price += BITCOST_MULTIPLIER / 5;   /* heuristic : make matches a bit more costly to favor less sequences -> faster decompression speed */
+
     DEBUGLOG(8, "ZSTD_getMatchPrice(ml:%u) = %u", matchLength, price);
     return price;
 }