Skip to content

Commit 94c3535

Browse files
committed
Do not set setStatus and monitorRunDependencies for wasm tests
emscripten generates the following code, ``` if (Module["setStatus"]) { Module["setStatus"]("Running..."); setTimeout(() => { setTimeout(() => Module["setStatus"](""), 1); doRun(); }, 1); } else { doRun(); } ``` And this code is ran in the first iteration of wasm benchmarks since it includes setup code. This causes a problem since it has artificially inserted setTimeout with 1ms. 1. It can insert 1ms wait time artificially. This is not so great since it reduces CPU pstate randomly, causing weird perf cliff depending on CPU's powner management instead of JS engine's quality. 2. The spec requires setTimeout to have some throttling mechanism. So we can hit some artificial large delay more than 1ms based on how many nestings we did before (https://webkit.org/blog/13083/speedometer-2-1/) This patch removes setStatus and monitorRunDependencies so that we will not use this `setTimeout` code path generated by emscripten. This is already done for SpiderMonkey shell. So we expand it for the other engines as well. Close #118
1 parent 6a9c126 commit 94c3535

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

JetStreamDriver.js

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,27 +1272,13 @@ class WasmEMCCBenchmark extends AsyncBenchmark {
12721272
noInitialRun: true,
12731273
print: print,
12741274
printErr: printErr,
1275-
setStatus: function(text) {
1276-
},
1277-
totalDependencies: 0,
1278-
monitorRunDependencies: function(left) {
1279-
this.totalDependencies = Math.max(this.totalDependencies, left);
1280-
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
1281-
},
1275+
totalDependencies: 0
12821276
};
12831277
12841278
globalObject.Module = Module;
12851279
${super.prerunCode};
12861280
`;
12871281

1288-
if (isSpiderMonkey) {
1289-
str += `
1290-
// Needed because SpiderMonkey shell doesn't have a setTimeout.
1291-
Module.setStatus = null;
1292-
Module.monitorRunDependencies = null;
1293-
`;
1294-
}
1295-
12961282
return str;
12971283
}
12981284
};
@@ -1414,13 +1400,7 @@ class WasmLegacyBenchmark extends Benchmark {
14141400
postRun: [],
14151401
print: globalObject.print,
14161402
printErr: globalObject.print,
1417-
setStatus: function(text) {
1418-
},
1419-
totalDependencies: 0,
1420-
monitorRunDependencies: function(left) {
1421-
this.totalDependencies = Math.max(this.totalDependencies, left);
1422-
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
1423-
}
1403+
totalDependencies: 0
14241404
};
14251405
globalObject.Module = Module;
14261406
`;
@@ -1451,9 +1431,6 @@ class WasmLegacyBenchmark extends Benchmark {
14511431
};
14521432
};
14531433
1454-
Module.setStatus = null;
1455-
Module.monitorRunDependencies = null;
1456-
14571434
Promise.resolve(42).then(() => {
14581435
try {
14591436
andThen();

0 commit comments

Comments
 (0)