From: Yann Collet Date: Tue, 4 Apr 2017 23:41:11 +0000 (-0700) Subject: fix paramgrill -O# X-Git-Tag: v1.2.0^2~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89b32f3db029456855fc591b55adbdc19d6fabec;p=thirdparty%2Fzstd.git fix paramgrill -O# ensure proposed config does not require more memory than necessary --- diff --git a/tests/paramgrill.c b/tests/paramgrill.c index 69f2aeb10..126e54d17 100644 --- a/tests/paramgrill.c +++ b/tests/paramgrill.c @@ -169,6 +169,11 @@ static size_t BMK_benchParam(BMK_result_t* resultPtr, char name[30] = { 0 }; U64 crcOrig; + /* init result for early exit */ + resultPtr->cSize = srcSize; + resultPtr->cSpeed = 0.; + resultPtr->dSpeed = 0.; + /* Memory allocation & restrictions */ snprintf(name, 30, "Sw%02uc%02uh%02us%02ul%1ut%03uS%1u", Wlog, Clog, Hlog, Slog, Slength, Tlength, strat); if (!compressedBuffer || !resultBuffer || !blockTable) { @@ -791,6 +796,7 @@ int optimizeForSize(const char* inFileName, U32 targetSpeed) ZSTD_compressionParameters params = winner.params; paramVariation(¶ms); if ((FUZ_rand(&g_rand) & 31) == 3) params = randomParams(); /* totally random config to improve search space */ + params = ZSTD_adjustCParams(params, blockSize, 0); /* exclude faster if already played set of params */ if (FUZ_rand(&g_rand) & ((1 << NB_TESTS_PLAYED(params))-1)) continue;