Upon inspecting the code in the element, it appears that they are solely focusing on creating a benchmark based on the execution time
or as referred to inside the code runTime = a - s
.
Extract from the code snippet:
for (var u of e.model.codeBlocks) {
u.result.percent = 0,
yield e.$sleep(e.model.pausePerBlock);
var m = e.runTestForAmountOfTime(u, e.model.timeToRun);
u.result = {
runTime: m.runTime,
amountOfRounds: m.counter,
percent: 0
};
var p = m.timer - d;
e.state.app.testProgress = Math.round(100 / c * p),
e.state.app.testProgress > 100 && (e.state.app.testProgress = 100),
yield e.$sleep(e.model.pausePerBlock)
}
Lastly, there is the function: runTestForAmountofTime
:
runTestForAmountOfTime(e, t) {
var o = "benchmark_" + e.id
, a = performance.now()
, s = performance.now()
, r = 0;
do {
this.iframe.contentWindow[o](arguments),
r++,
s = performance.now()
} while (s - a < t && !this.model.errorMessage);
return {
counter: r,
runTime: a - s, // The crucial point lies here
timer: s
}
}