summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-11-03 07:15:52 (GMT)
committerYann Collet <cyan@fb.com>2017-11-03 07:15:52 (GMT)
commit890c0553d08ad6a6a4f2801523667413b5477512 (patch)
treee0c3a0e9272aa5f59dffe427893e2ba689bfda28 /lib
parent05d78eb817fc3eea13bd89377e771bbe19bb02c3 (diff)
downloadlz4-890c0553d08ad6a6a4f2801523667413b5477512.zip
lz4-890c0553d08ad6a6a4f2801523667413b5477512.tar.gz
lz4-890c0553d08ad6a6a4f2801523667413b5477512.tar.bz2
optimized skip strategy for level 12
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4opt.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/lz4opt.h b/lib/lz4opt.h
index 0463cb1..edcfc10 100644
--- a/lib/lz4opt.h
+++ b/lib/lz4opt.h
@@ -243,7 +243,6 @@ static int LZ4HC_compress_optimal (
const BYTE* const matchlimit = iend - LASTLITERALS;
BYTE* op = (BYTE*) dst;
BYTE* const oend = op + dstCapacity;
- int const front = fullUpdate ? 2 : 1;
/* init */
DEBUGLOG(5, "LZ4HC_compress_optimal");
@@ -317,12 +316,16 @@ static int LZ4HC_compress_optimal (
if (curPtr >= mflimit) break;
DEBUGLOG(7, "rPos:%u[%u] vs [%u]%u",
cur, opt[cur].price, opt[cur+1].price, cur+1);
- if (opt[cur+front].price <= opt[cur].price) continue;
+ if (fullUpdate) {
+ if ((opt[cur+1].price <= opt[cur].price) && (opt[cur+4].price < opt[cur].price+3)) continue;
+ } else {
+ if (opt[cur+1].price <= opt[cur].price) continue;
+ }
DEBUGLOG(7, "search at rPos:%u", cur);
//nb_matches = LZ4HC_BinTree_GetAllMatches(ctx, curPtr, matchlimit, MINMATCH-1, matches, fullUpdate);
nb_matches = LZ4HC_HashChain_GetAllMatches(ctx, curPtr, matchlimit, MINMATCH-1, matches, fullUpdate);
- //nb_matches = LZ4HC_HashChain_GetAllMatches(ctx, curPtr, matchlimit, last_match_pos - cur - 1, matches, fullUpdate); /* only test matches of a minimum length */
+ //nb_matches = LZ4HC_HashChain_GetAllMatches(ctx, curPtr, matchlimit, last_match_pos - cur, matches, fullUpdate); /* only test matches of a minimum length */
if (!nb_matches) continue;
if ( ((size_t)matches[nb_matches-1].len > sufficient_len)