Math.ceil vs. bitwise

Benchmark created by Remy 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
<<
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.