1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-05 19:15:58 +03:00

paramgrill supports sufficientLength

stronger variation for ZSTD_opt
This commit is contained in:
Yann Collet
2016-02-10 17:07:37 +01:00
parent 62ae262771
commit b79a0b34f3
3 changed files with 9 additions and 14 deletions

View 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, 24, 23, 5, 5, ZSTD_btlazy2 }, /* level 18 */
{ 0, 0, 25, 26, 23, 5, 5, ZSTD_btlazy2 }, /* level 19 */ { 0, 0, 25, 26, 23, 5, 5, ZSTD_btlazy2 }, /* level 19 */
{ 0, 0, 26, 27, 25, 9, 5, ZSTD_btlazy2 }, /* level 20 */ { 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 21 = 16 + L=4 */ // 41233150 btlazy1=41560211 norep1=42322286
{ 0, 0, 23, 21, 22, 5, 4, ZSTD_btlazy2 }, /* level 22 = 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 }, /* level 23 */
{ 0, 32, 23, 21, 22, 5, 4, ZSTD_opt_bt }, /* level 24 = 16 + btopt */ { 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 */ { 0, 64, 26, 27, 25, 10, 4, ZSTD_opt_bt }, /* level 25 = 20 + btopt */

View 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) FORCE_INLINE U32 ZSTD_getLiteralPrice(seqStore_t* seqStorePtr, U32 litLength, const BYTE* literals)
{ {
if (seqStorePtr->litSum > ZSTD_FREQ_THRESHOLD) 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) FORCE_INLINE U32 ZSTD_getMatchPriceReal(seqStore_t* seqStorePtr, U32 offset, U32 matchLength)
{ {
/* offset */ /* offset */
@@ -304,8 +302,7 @@ FORCE_INLINE U32 ZSTD_BtGetAllMatches_selectMLS_extDict (
const BYTE* ip, const BYTE* const iLowLimit, const BYTE* const iHighLimit, const BYTE* ip, const BYTE* const iLowLimit, const BYTE* const iHighLimit,
const U32 maxNbAttempts, const U32 matchLengthSearch, ZSTD_match_t* matches, U32 minml) const U32 maxNbAttempts, const U32 matchLengthSearch, ZSTD_match_t* matches, U32 minml)
{ {
if (iLowLimit) {}; // skip warnings (void)iLowLimit;
switch(matchLengthSearch) switch(matchLengthSearch)
{ {
default : default :
@@ -353,10 +350,9 @@ U32 ZSTD_HcGetAllMatches_generic (
nbAttempts--; nbAttempts--;
if ((!extDict) || matchIndex >= dictLimit) { if ((!extDict) || matchIndex >= dictLimit) {
match = base + matchIndex; match = base + matchIndex;
if (match[minml] == ip[minml]) /* potentially better */ //if (match[minml] == ip[minml]) currentMl = ZSTD_count(ip, match, iHighLimit); if (currentMl>0) { // faster
currentMl = ZSTD_count(ip, match, iHighLimit); if (MEM_read32(match) == MEM_read32(ip)) { currentMl = ZSTD_count(ip+MINMATCH, match+MINMATCH, iHighLimit)+MINMATCH; // stronger
if (currentMl>0) { while ((match-back > base) && (ip-back > iLowLimit) && (ip[-back-1] == match[-back-1])) back++;
while ((match-back > base) && (ip-back > iLowLimit) && (ip[-back-1] == match[-back-1])) back++; /* backward match extension */
currentMl += back; currentMl += back;
} }
} else { } else {
@@ -365,8 +361,7 @@ U32 ZSTD_HcGetAllMatches_generic (
currentMl = ZSTD_count_2segments(ip+MINMATCH, match+MINMATCH, iHighLimit, dictEnd, prefixStart) + MINMATCH; 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 */ while ((match-back > dictStart) && (ip-back > iLowLimit) && (ip[-back-1] == match[-back-1])) back++; /* backward match extension */
currentMl += back; currentMl += back;
} } }
}
/* save best solution */ /* save best solution */
if (currentMl > minml) { if (currentMl > minml) {

View 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 { typedef struct {
BMK_result_t result; BMK_result_t result;
@@ -559,7 +559,7 @@ static void paramVariation(ZSTD_parameters* p)
{ {
U32 nbChanges = (FUZ_rand(&g_rand) & 3) + 1; U32 nbChanges = (FUZ_rand(&g_rand) & 3) + 1;
for (; nbChanges; nbChanges--) { for (; nbChanges; nbChanges--) {
const U32 changeID = FUZ_rand(&g_rand) % 12; const U32 changeID = FUZ_rand(&g_rand) % 14;
switch(changeID) switch(changeID)
{ {
case 0: case 0: