floor and and

Benchmark created by kay on


Setup

var data = [];
  for (var n = 0; n < 10000; ++n) {
    data.push(Math.random() * n);
  }
  var d;

  Benchmark.prototype.setup = function() {
    d = data.slice();
  };

Teardown


    d = null;
  

Test runner

Ready to run.

Testing in
TestOps/sec
floor
console.log((function() {
  var result = [];
  var a;
  while (a = d.shift()) {
    result.push(Math.floor(a));
  }
  return result;
})(d));
ready
&1
console.log((function() {
  var result = [];
  var a;
  while (a = d.shift()) {
    result.push(a & 0xffffffff);
  }
  return result;
})(d));
ready

Revisions

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