for in object key (v2)

Revision 2 of this benchmark created on


Setup

var temp = {
      x: 0,
      y: 0,
      z: 0
    };

Test runner

Ready to run.

Testing in
TestOps/sec
for in
for (var i in temp) {
  console.log(temp[i]);
}
ready
obj key
var obj = Object.keys(temp);
var length = obj.length;

for (var i = 0; i != length; i++) {
  console.log(temp[obj[i]]);
}
ready
obj key while
var obj = Object.keys(temp);
var i = obj.length-1;

while (i) {
console.log(temp[obj[i]]);
i--;
}
ready
obj key while --
var obj = Object.keys(temp);
var length = obj.length;
var i=length;

while (i) {
console.log(temp[obj[length-i]]);
i--;
}
ready

Revisions

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