summaryrefslogtreecommitdiffstats
path: root/lib/lz4hc.c
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-06-14 00:25:29 (GMT)
committerYann Collet <cyan@fb.com>2017-06-14 00:25:29 (GMT)
commit89b9f026c913c0d3e9995f52b49b37f1de1af150 (patch)
tree0972c766fd28f0f83cb102473152cf059d129fa4 /lib/lz4hc.c
parenta6fd0f9d0ba4dd3db5ffd221a6b3384296a8deed (diff)
downloadlz4-89b9f026c913c0d3e9995f52b49b37f1de1af150.zip
lz4-89b9f026c913c0d3e9995f52b49b37f1de1af150.tar.gz
lz4-89b9f026c913c0d3e9995f52b49b37f1de1af150.tar.bz2
made level 10 a bit faster
at the expense of a little bit of compression ratio. Now speed is intermediate on calgary corpus : 25 - 12 - 8 - 3
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r--lib/lz4hc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index b987d39..a423aea 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -182,7 +182,7 @@ FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch (
const BYTE* const dictBase = hc4->dictBase;
int const delta = (int)(ip-iLowLimit);
int nbAttempts = maxNbAttempts;
- U32 matchIndex;
+ U32 matchIndex;
/* First Match */
@@ -192,16 +192,17 @@ FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch (
while ((matchIndex>=lowLimit) && (nbAttempts)) {
nbAttempts--;
if (matchIndex >= dictLimit) {
- const BYTE* matchPtr = base + matchIndex;
+ const BYTE* const matchPtr = base + matchIndex;
if (*(iLowLimit + longest) == *(matchPtr - delta + longest)) {
if (LZ4_read32(matchPtr) == LZ4_read32(ip)) {
int mlt = MINMATCH + LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
int back = 0;
- while ((ip+back > iLowLimit)
- && (matchPtr+back > lowPrefixPtr)
- && (ip[back-1] == matchPtr[back-1]))
+ while ( (ip+back > iLowLimit)
+ && (matchPtr+back > lowPrefixPtr)
+ && (ip[back-1] == matchPtr[back-1])) {
back--;
+ }
mlt -= back;
@@ -548,7 +549,7 @@ static int LZ4HC_compress_generic (
if (limit == limitedDestSize) cLevel = 10;
switch (cLevel) {
case 10:
- return LZ4HC_compress_hashChain(ctx, src, dst, srcSizePtr, dstCapacity, 1 << (15-1), limit);
+ return LZ4HC_compress_hashChain(ctx, src, dst, srcSizePtr, dstCapacity, 1 << 12, limit);
case 11:
ctx->searchNum = LZ4HC_getSearchNum(cLevel);
return LZ4HC_compress_optimal(ctx, src, dst, *srcSizePtr, dstCapacity, limit, 128, 0);