ceil/floor

Benchmark created by Stoyan on


Description

how does rounding help

Preparation HTML

<div id="me" style="position:absolute; color:red">boo</div>
<script>
  function move(a) {
   var me = document.getElementById('me'),
       flush = me.offsetTop,
       where = a + 'px';
   me.style.top = where;
   me.style.left = where;
   flush = me.offsetTop;
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
ceil
move(Math.ceil(25 / 2));
move(Math.ceil(50 / 3));
ready
none
move(25 / 2);
move(50 / 3);
ready

Revisions

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