tilde vs floor vs others (v7)

Revision 7 of this benchmark created on


Description

Comparison between ~~ and Math.floor, bitwise or with zero, shift, modulo operator, parseInt.

Preparation HTML

<script>
  var x = 3.14;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
tildes
var y = ~~x;
ready
floor
var y = Math.floor(x);
ready
modulo
var y = x - x % 1;
ready
parseInt
var y = parseInt(x,10);
ready
shift
var y = x >> 0;
ready
or
var y = x | 0;
ready

Revisions

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