summaryrefslogtreecommitdiff
path: root/cli/js
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-10-10 14:40:36 +0100
committerGitHub <noreply@github.com>2023-10-10 14:40:36 +0100
commit0606c1140389d8e036087bb24e03bc43d727ffd0 (patch)
treec1b91f685e8fd9e56d3c54b7d37ccc8609fd4515 /cli/js
parent6450334f5bbb059b55005cebfef57fa7969b625e (diff)
fix(bench): use total time when measuring wavg (#20862)
Diffstat (limited to 'cli/js')
-rw-r--r--cli/js/40_testing.js10
1 files changed, 2 insertions, 8 deletions
diff --git a/cli/js/40_testing.js b/cli/js/40_testing.js
index 7b60dd133..f4eb0a5a7 100644
--- a/cli/js/40_testing.js
+++ b/cli/js/40_testing.js
@@ -982,20 +982,17 @@ async function benchMeasure(timeBudget, fn, async, context) {
fn(context);
const t2 = benchNow();
const totalTime = t2 - t1;
- let measuredTime = totalTime;
if (currentBenchUserExplicitStart !== null) {
- measuredTime -= currentBenchUserExplicitStart - t1;
currentBenchUserExplicitStart = null;
usedExplicitTimers = true;
}
if (currentBenchUserExplicitEnd !== null) {
- measuredTime -= t2 - currentBenchUserExplicitEnd;
currentBenchUserExplicitEnd = null;
usedExplicitTimers = true;
}
c++;
- wavg += measuredTime;
+ wavg += totalTime;
budget -= totalTime;
}
} else {
@@ -1004,20 +1001,17 @@ async function benchMeasure(timeBudget, fn, async, context) {
await fn(context);
const t2 = benchNow();
const totalTime = t2 - t1;
- let measuredTime = totalTime;
if (currentBenchUserExplicitStart !== null) {
- measuredTime -= currentBenchUserExplicitStart - t1;
currentBenchUserExplicitStart = null;
usedExplicitTimers = true;
}
if (currentBenchUserExplicitEnd !== null) {
- measuredTime -= t2 - currentBenchUserExplicitEnd;
currentBenchUserExplicitEnd = null;
usedExplicitTimers = true;
}
c++;
- wavg += measuredTime;
+ wavg += totalTime;
budget -= totalTime;
}
}