Skip to content

Commit 1408ec2

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 1408ec2

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

JetStreamDriver.js

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,28 +1271,13 @@ class WasmEMCCBenchmark extends AsyncBenchmark {
12711271
postRun: [],
12721272
noInitialRun: true,
12731273
print: print,
1274-
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-
},
1274+
printErr: printErr
12821275
};
12831276
12841277
globalObject.Module = Module;
12851278
${super.prerunCode};
12861279
`;
12871280

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-
12961281
return str;
12971282
}
12981283
};
@@ -1413,14 +1398,7 @@ class WasmLegacyBenchmark extends Benchmark {
14131398
preRun: [],
14141399
postRun: [],
14151400
print: globalObject.print,
1416-
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-
}
1401+
printErr: globalObject.print
14241402
};
14251403
globalObject.Module = Module;
14261404
`;
@@ -1451,9 +1429,6 @@ class WasmLegacyBenchmark extends Benchmark {
14511429
};
14521430
};
14531431
1454-
Module.setStatus = null;
1455-
Module.monitorRunDependencies = null;
1456-
14571432
Promise.resolve(42).then(() => {
14581433
try {
14591434
andThen();

0 commit comments

Comments
 (0)