testinglow

Benchmark created by Ilya on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

function getSecond (day){
      return (day % 100) % 60;
    }
    function getQMinute(day) {
      var second = getSecond(day);
      if(second < 15)
         return 1;
      if(second < 30)
         return 2;
      if(second < 45)
         return 3;
      return 4;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
method
var rand = Math.random()*62;
var result = getQMinute(rand);
ready
+1
var rand = Math.random()*62;
var result = (getSecond(rand)/15)|0 + 1;
ready
ceil
var rand = Math.random()*62;
var result = Math.ceil(getSecond(rand)/15);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.