Skip to content

Commit 75e6c6c

Browse files
committed
Set setStatus: null and monitorRunDependencies: null explicitly 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 explicitly sets setStatus and monitorRunDependencies to null 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 fadffe7 commit 75e6c6c

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

JetStreamDriver.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,27 +1239,15 @@ class WasmEMCCBenchmark extends AsyncBenchmark {
12391239
noInitialRun: true,
12401240
print: print,
12411241
printErr: printErr,
1242-
setStatus: function(text) {
1243-
},
1242+
setStatus: null,
12441243
totalDependencies: 0,
1245-
monitorRunDependencies: function(left) {
1246-
this.totalDependencies = Math.max(this.totalDependencies, left);
1247-
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
1248-
},
1244+
monitorRunDependencies: null
12491245
};
12501246
12511247
globalObject.Module = Module;
12521248
${super.prerunCode};
12531249
`;
12541250

1255-
if (isSpiderMonkey) {
1256-
str += `
1257-
// Needed because SpiderMonkey shell doesn't have a setTimeout.
1258-
Module.setStatus = null;
1259-
Module.monitorRunDependencies = null;
1260-
`;
1261-
}
1262-
12631251
return str;
12641252
}
12651253
};
@@ -1379,13 +1367,9 @@ class WasmLegacyBenchmark extends Benchmark {
13791367
postRun: [],
13801368
print: globalObject.print,
13811369
printErr: globalObject.print,
1382-
setStatus: function(text) {
1383-
},
1370+
setStatus: null,
13841371
totalDependencies: 0,
1385-
monitorRunDependencies: function(left) {
1386-
this.totalDependencies = Math.max(this.totalDependencies, left);
1387-
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
1388-
}
1372+
monitorRunDependencies: null
13891373
};
13901374
globalObject.Module = Module;
13911375
`;

0 commit comments

Comments
 (0)