Home > Enterprise >  How to read jsben.ch benchmark result?
How to read jsben.ch benchmark result?

Time:09-17

I've compared three fibonacci algorithms with fibonacci algorithms benchmark results

Yet, I can't find what the numbers next to code block result mean? The higher, the better but what's the unit?

CodePudding user response:

The only reasonable unit I can think (and this is my assumption) it that the result shows ops/sec meaning how many times each test can execute in a sec.

However, it would be better if the jsben.ch had this stated clearly to avoid confusion or at least explained the meaning in help section (which is also sadly missing).

CodePudding user response:

Looking at the code (inspect element) it seems that they only create the benchmark looking at the execution time or how they call it runTime = a - s.

From the code:

 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)
}

And finally the method: 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,         // I think that this is the point 
      timer: s
   }
}
  • Related