Add warmupBeforeSync parameter, which triggers speciefied milliseconds of infinite loop before each sync step. (#196)

This will allow us to evaluate the impact of using rAF vs. timer with regards to CPU throttling.
This commit is contained in:
Ryosuke Niwa 2023-05-31 11:53:53 -04:00 committed by GitHub
parent 4f9ffb5e3b
commit ec51e3188b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -350,6 +350,10 @@ export class BenchmarkRunner {
let asyncStartTime;
let asyncTime;
const runSync = () => {
if (params.warmupBeforeSync) {
const startTime = performance.now();
while (performance.now() - startTime < params.warmupBeforeSync); // Infinite loop for the specified ms.
}
performance.mark(startLabel);
const syncStartTime = performance.now();
test.run(this._page);

View file

@ -51,6 +51,13 @@ class Params {
searchParams.delete("useWarmupSuite");
}
if (searchParams.has("warmupBeforeSync")) {
this.warmupBeforeSync = parseInt(searchParams.get("warmupBeforeSync"));
if (this.warmupBeforeSync < 1)
throw new Error(`Invalid warmupBeforeSync param: ${this.warmupBeforeSync}`);
searchParams.delete("warmupBeforeSync");
}
if (searchParams.has("measurementMethod")) {
this.measurementMethod = searchParams.get("measurementMethod");
if (this.measurementMethod !== "timer" && this.measurementMethod !== "raf")