]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
paramgrill supports sufficientLength
authorYann Collet <yann.collet.73@gmail.com>
Wed, 10 Feb 2016 16:07:37 +0000 (17:07 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Wed, 10 Feb 2016 16:07:37 +0000 (17:07 +0100)
stronger variation for ZSTD_opt

lib/zstd_compress.c
lib/zstd_opt.h
programs/paramgrill.c

index db774ccd87736ac158ac65d52e2135aaeb9f08ce..d59ff12aeaa80269dabd1bd24ae6809efda29dfb 100644 (file)
@@ -2341,8 +2341,8 @@ static const ZSTD_parameters ZSTD_defaultParameters[4][ZSTD_MAX_CLEVEL+1] = {
     { 0,  0, 25, 24, 23,  5,  5, ZSTD_btlazy2 },  /* level 18 */
     { 0,  0, 25, 26, 23,  5,  5, ZSTD_btlazy2 },  /* level 19 */
     { 0,  0, 26, 27, 25,  9,  5, ZSTD_btlazy2 },  /* level 20 */
-    { 0,  0, 22, 20, 22,  4,  4, ZSTD_lazy2   },  /* level 21 = 11 + L=4 */ // 41902762   lazy1=42087013     norep1=42911693
-    { 0,  0, 23, 21, 22,  5,  4, ZSTD_btlazy2 },  /* level 22 = 16 + L=4 */ // 41233150   btlazy1=41560211   norep1=42322286
+    { 0,  0, 23, 21, 22,  5,  4, ZSTD_btlazy2 },  /* level 21 = 16 + L=4 */ // 41233150   btlazy1=41560211   norep1=42322286
+    { 0, 12, 23, 21, 22,  5,  4, ZSTD_opt     },  /* level 22 */
     { 0, 32, 23, 21, 22,  5,  4, ZSTD_opt     },  /* level 23 */
     { 0, 32, 23, 21, 22,  5,  4, ZSTD_opt_bt  },  /* level 24 = 16 + btopt */
     { 0, 64, 26, 27, 25, 10,  4, ZSTD_opt_bt  },  /* level 25 = 20 + btopt */
index 951bc732264b4456e68a3edbc4792ffbe997d5f6..579558b11df6f6a73e8ad2cf55659914c1cbb38f 100644 (file)
@@ -92,7 +92,6 @@ FORCE_INLINE U32 ZSTD_getLiteralPriceReal(seqStore_t* seqStorePtr, U32 litLength
 }
 
 
-
 FORCE_INLINE U32 ZSTD_getLiteralPrice(seqStore_t* seqStorePtr, U32 litLength, const BYTE* literals)
 {
     if (seqStorePtr->litSum > ZSTD_FREQ_THRESHOLD)
@@ -102,7 +101,6 @@ FORCE_INLINE U32 ZSTD_getLiteralPrice(seqStore_t* seqStorePtr, U32 litLength, co
 }
 
 
-
 FORCE_INLINE U32 ZSTD_getMatchPriceReal(seqStore_t* seqStorePtr, U32 offset, U32 matchLength)
 {
     /* offset */
@@ -304,8 +302,7 @@ FORCE_INLINE U32 ZSTD_BtGetAllMatches_selectMLS_extDict (
                         const BYTE* ip, const BYTE* const iLowLimit, const BYTE* const iHighLimit,
                         const U32 maxNbAttempts, const U32 matchLengthSearch, ZSTD_match_t* matches, U32 minml)
 {
-    if (iLowLimit) {}; // skip warnings
-
+    (void)iLowLimit;
     switch(matchLengthSearch)
     {
     default :
@@ -353,10 +350,9 @@ U32 ZSTD_HcGetAllMatches_generic (
         nbAttempts--;
         if ((!extDict) || matchIndex >= dictLimit) {
             match = base + matchIndex;
-            if (match[minml] == ip[minml])   /* potentially better */
-                currentMl = ZSTD_count(ip, match, iHighLimit);
-            if (currentMl>0) {
-                while ((match-back > base) && (ip-back > iLowLimit) && (ip[-back-1] == match[-back-1])) back++;   /* backward match extension */
+            //if (match[minml] == ip[minml]) currentMl = ZSTD_count(ip, match, iHighLimit); if (currentMl>0) {   // faster
+             if (MEM_read32(match) == MEM_read32(ip)) { currentMl = ZSTD_count(ip+MINMATCH, match+MINMATCH, iHighLimit)+MINMATCH;  // stronger
+                while ((match-back > base) && (ip-back > iLowLimit) && (ip[-back-1] == match[-back-1])) back++;
                 currentMl += back;
             }
         } else {
@@ -365,8 +361,7 @@ U32 ZSTD_HcGetAllMatches_generic (
                 currentMl = ZSTD_count_2segments(ip+MINMATCH, match+MINMATCH, iHighLimit, dictEnd, prefixStart) + MINMATCH;
                 while ((match-back > dictStart) && (ip-back > iLowLimit) && (ip[-back-1] == match[-back-1])) back++;   /* backward match extension */
                 currentMl += back;
-            }
-        }
+        }   }
 
         /* save best solution */
         if (currentMl > minml) {
index fd75aa327b919628b78b0ffdb931bf218a79c4d9..e3f421277105326850f8c406558488eac779ad57 100644 (file)
@@ -421,7 +421,7 @@ static void BMK_printWinner(FILE* f, U32 cLevel, BMK_result_t result, ZSTD_param
 }
 
 
-static U32 g_cSpeedTarget[NB_LEVELS_TRACKED] = { 0 };   /* NB_LEVELS_TRACKED : to check */
+static U32 g_cSpeedTarget[NB_LEVELS_TRACKED] = { 0 };   /* NB_LEVELS_TRACKED : checked at main() */
 
 typedef struct {
     BMK_result_t result;
@@ -559,7 +559,7 @@ static void paramVariation(ZSTD_parameters* p)
 {
     U32 nbChanges = (FUZ_rand(&g_rand) & 3) + 1;
     for (; nbChanges; nbChanges--) {
-        const U32 changeID = FUZ_rand(&g_rand) % 12;
+        const U32 changeID = FUZ_rand(&g_rand) % 14;
         switch(changeID)
         {
         case 0: