objvsarr (v2)

Revision 2 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
A
var y = 0;

for (var i = 0; i < 1000; i++) {
  var x = [['a', 1],['b', 2],['c', 3],['d', 4],['e', 5]];
  for (var j = 0; j < x.length; j++) {
    y += x[j][1];
  }
}
ready
B
var y = 0;

for (var i = 0; i < 1000; i++) {
  var x = {a: 1, b: 2, c: 3, d: 4, e: 5};
  for (var j in x) {
    if (x.hasOwnProperty(j)) {
      y += x[j];
    }
  }
}
ready

Revisions

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