Or vs Floor (v16)

Revision 16 of this benchmark created by David Bonnet 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, floor=Math.floor;
var sum = 0;
while ( i-- ) {
    sum += floor( array[ i ] );
}
ready
OR
var i = 100000;
var sum = 0;
while ( i-- ) {
    sum += array[ i ] | 0;
}
ready

Revisions

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