From e2c0e3d4371ec4b61a16609cacf1d517dc48cb36 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Fri, 25 May 2018 14:52:21 -0700 Subject: [PATCH] slightly nudge choices towards less sequences also slightly improve some strange detrimental corner cases. --- lib/compress/zstd_opt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/compress/zstd_opt.c b/lib/compress/zstd_opt.c index 2a699c2a..e66019aa 100644 --- a/lib/compress/zstd_opt.c +++ b/lib/compress/zstd_opt.c @@ -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; }