Or vs Floor (v14)

Revision 14 of this benchmark created on


Preparation HTML

<script>
  var i = 100000;
  var array = [];
  while ( i-- ) {
      array[ i ] = Math.random() * 100;
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Floor
var i = 100000;
var sum = 0;
while (i--) {
  sum += Math.floor(array[i]);
}
ready
OR
var i = 100000;
var sum = 0;
while (i--) {
  sum += array[i] | 0;
}
ready
~~
var i = 100000;
var sum = 0;
while (i--) {
  sum += ~~array[i];
}
ready

Revisions

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