From: Yann Collet Date: Tue, 28 Aug 2018 02:07:17 +0000 (-0700) Subject: paramgrill: removed useless tests X-Git-Tag: v0.0.29~26^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ff9b675528722562e8035b3dfc8b62503339af8;p=thirdparty%2Fzstd.git paramgrill: removed useless tests designed to compensate iter_mode, but since only time_mode is available now, all tests are guaranteed to last a minimum amount of time. --- diff --git a/tests/paramgrill.c b/tests/paramgrill.c index 12a06688b..7346250a7 100644 --- a/tests/paramgrill.c +++ b/tests/paramgrill.c @@ -1547,13 +1547,13 @@ static int allBench(BMK_benchResult_t* resultPtr, const constraint_t target, BMK_benchResult_t* winnerResult, int feas) { - BMK_benchResult_t resultMax, benchres; + BMK_benchResult_t benchres; U64 loopDurationC = 0, loopDurationD = 0; double uncertaintyConstantC = 3., uncertaintyConstantD = 3.; double winnerRS; /* initial benchmarking, gives exact ratio and memory, warms up future runs */ - CBENCHMARK(1, benchres, tmp, BMK_both, 1); + CBENCHMARK(1, benchres, tmp, BMK_both, 2); winnerRS = resultScore(*winnerResult, buf.srcSize, target); DEBUGOUTPUT("WinnerScore: %f\n ", winnerRS); @@ -1562,12 +1562,12 @@ static int allBench(BMK_benchResult_t* resultPtr, /* calculate uncertainty in compression / decompression runs */ if(benchres.cSpeed) { - loopDurationC = ((buf.srcSize * TIMELOOP_NANOSEC) / benchres.cSpeed); + loopDurationC = (((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.cSpeed); uncertaintyConstantC = ((loopDurationC + (double)(2 * g_clockGranularity))/loopDurationC); } if(benchres.dSpeed) { - loopDurationD = ((buf.srcSize * TIMELOOP_NANOSEC) / benchres.dSpeed); + loopDurationD = (((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.dSpeed); uncertaintyConstantD = ((loopDurationD + (double)(2 * g_clockGranularity))/loopDurationD); } @@ -1576,30 +1576,25 @@ static int allBench(BMK_benchResult_t* resultPtr, return WORSE_RESULT; } + /* ensure all measurements last a minimum time, to reduce measurement errors */ assert(loopDurationC >= TIMELOOP_NANOSEC / 10); assert(loopDurationD >= TIMELOOP_NANOSEC / 10); - /* second run, if first run is too short, gives approximate cSpeed + dSpeed */ - CBENCHMARK(loopDurationC < TIMELOOP_NANOSEC / 10, benchres, tmp, BMK_compressOnly, 1); - CBENCHMARK(loopDurationD < TIMELOOP_NANOSEC / 10, benchres, tmp, BMK_decodeOnly, 1); - *resultPtr = benchres; /* optimistic assumption of benchres */ - resultMax = benchres; - resultMax.cSpeed *= uncertaintyConstantC * VARIANCE; - resultMax.dSpeed *= uncertaintyConstantD * VARIANCE; - - /* disregard infeasible results in feas mode */ - /* disregard if resultMax < winner in infeas mode */ - if((feas && !feasible(resultMax, target)) || - (!feas && (winnerRS > resultScore(resultMax, buf.srcSize, target)))) { - return WORSE_RESULT; + { BMK_benchResult_t resultMax = benchres; + resultMax.cSpeed *= uncertaintyConstantC * VARIANCE; + resultMax.dSpeed *= uncertaintyConstantD * VARIANCE; + + /* disregard infeasible results in feas mode */ + /* disregard if resultMax < winner in infeas mode */ + if((feas && !feasible(resultMax, target)) || + (!feas && (winnerRS > resultScore(resultMax, buf.srcSize, target)))) { + return WORSE_RESULT; + } } - CBENCHMARK(loopDurationC < TIMELOOP_NANOSEC, benchres, tmp, BMK_compressOnly, 1); - CBENCHMARK(loopDurationD < TIMELOOP_NANOSEC, benchres, tmp, BMK_decodeOnly, 1); - *resultPtr = benchres; /* compare by resultScore when in infeas */ @@ -1612,6 +1607,7 @@ static int allBench(BMK_benchResult_t* resultPtr, } } + #define INFEASIBLE_THRESHOLD 200 /* Memoized benchmarking, won't benchmark anything which has already been benchmarked before. */ static int benchMemo(BMK_benchResult_t* resultPtr, @@ -1639,6 +1635,7 @@ static int benchMemo(BMK_benchResult_t* resultPtr, return res; } + typedef struct { U64 cSpeed_min; U64 dSpeed_min;