]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
paramgrill: removed useless tests
authorYann Collet <cyan@fb.com>
Tue, 28 Aug 2018 02:07:17 +0000 (19:07 -0700)
committerYann Collet <cyan@fb.com>
Tue, 28 Aug 2018 02:07:17 +0000 (19:07 -0700)
designed to compensate iter_mode,
but since only time_mode is available now,
all tests are guaranteed to last a minimum amount of time.

tests/paramgrill.c

index 12a06688b89185350322245fe77545dc99a5cf79..7346250a7a1dcb5c22fb2c9cfe3062661f50a5c8 100644 (file)
@@ -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;