for loop perf demo (v8)

Revision 8 of this benchmark created on


Setup

var obj = {};
    for(var i = 0; i < 100; i = i + 1) {
      var item = {index: i};
      obj[i] = item;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
for loop heavy
var sum = 0;
for(var x = 0; x < 100; x++){
  var keys = Object.keys(obj);
  sum = sum + keys[x];
}
ready
for loop heavy mini
for(var sum=0,x=0;100>x;x++){var keys=Object.keys(obj);sum+=keys[x]}
ready

Revisions

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