Math.ceil vs. bitwise (v11)

Revision 11 of this benchmark created by Rowaa[SR13] on


Description

...and some extra logic to handle ints. ::sigh::

Preparation HTML

<script>
  // am I insane?
  var n = Math.random() * (Math.random() + '').substr(2);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Math.ceil
var f = Math.ceil(n);
ready
<< and ?
var f = (n << 0),
    f = f === n ? f : f + 1;
ready
| and +0.5
var f = (n + 0.5) | 0;
ready
| and ?
var f = (n | 0),
    f = f === n ? f : f + 1;
ready

Revisions

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