1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-01 09:47:01 +03:00

Fixed speed regression

This commit is contained in:
Yann Collet
2015-11-01 12:40:22 +01:00
parent be2010ea1b
commit 9b11b46f8a
2 changed files with 131 additions and 114 deletions

View File

@ -122,7 +122,8 @@ static U32 g_rand = 1;
static U32 g_singleRun = 0;
static U32 g_target = 0;
static U32 g_noSeed = 0;
static ZSTD_HC_parameters g_params = { 0, 0, 0, 0, 0, 0 };
static const ZSTD_HC_parameters* g_seedParams = ZSTD_HC_defaultParameters;
static ZSTD_HC_parameters g_params = { 0, 0, 0, 0, 0, ZSTD_HC_greedy };
void BMK_SetNbIterations(int nbLoops)
{
@ -623,9 +624,9 @@ static void playAround(FILE* f, winnerInfo_t* winners,
case 9:
p.searchLength--; break;
case 10:
p.strategy++; break;
p.strategy = ZSTD_HC_lazy; break;
case 11:
p.strategy--; break;
p.strategy = ZSTD_HC_greedy; break;
}
}
@ -674,7 +675,7 @@ static void BMK_selectRandomStart(
p.searchLog = FUZ_rand(&g_rand) % (ZSTD_HC_SEARCHLOG_MAX+1 - ZSTD_HC_SEARCHLOG_MIN) + ZSTD_HC_SEARCHLOG_MIN;
p.windowLog = FUZ_rand(&g_rand) % (ZSTD_HC_WINDOWLOG_MAX+1 - ZSTD_HC_WINDOWLOG_MIN) + ZSTD_HC_WINDOWLOG_MIN;
p.searchLength=FUZ_rand(&g_rand) % (ZSTD_HC_SEARCHLENGTH_MAX+1 - ZSTD_HC_SEARCHLENGTH_MIN) + ZSTD_HC_SEARCHLENGTH_MIN;
p.strategy = FUZ_rand(&g_rand) & 1;
p.strategy = (ZSTD_HC_strategy) (FUZ_rand(&g_rand) & 1);
playAround(f, winners, p, srcBuffer, srcSize, ctx);
}
else
@ -682,8 +683,6 @@ static void BMK_selectRandomStart(
}
static const ZSTD_HC_parameters* g_seedParams = ZSTD_HC_defaultParameters;
static void BMK_benchMem(void* srcBuffer, size_t srcSize)
{
ZSTD_HC_CCtx* ctx = ZSTD_HC_createCCtx();
@ -968,12 +967,20 @@ int main(int argc, char** argv)
while ((*argument>= '0') && (*argument<='9'))
g_params.searchLog *= 10, g_params.searchLog += *argument++ - '0';
continue;
case 'l':
case 'l': /* search length */
g_params.searchLength = 0;
argument++;
while ((*argument>= '0') && (*argument<='9'))
g_params.searchLength *= 10, g_params.searchLength += *argument++ - '0';
continue;
case 't': /* strategy */
g_params.strategy = ZSTD_HC_greedy;
argument++;
while ((*argument>= '0') && (*argument<='9'))
{
if (*argument++) g_params.strategy = ZSTD_HC_lazy;
}
continue;
case 'L':
{
int cLevel = 0;