5

I've compared three fibonacci algorithms with jsben.ch and as expected first one is the fastest (it even got a little award icon):

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?

iaforek
  • 2,860
  • 5
  • 40
  • 56

2 Answers2

2

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

iaforek
  • 2,860
  • 5
  • 40
  • 56
0

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
   }
}
c3R1cGFy
  • 505
  • 4
  • 12