so-question-9853395

Benchmark created by Matt Ball on


Setup

var data = {
      foo: {
        content: {
          a: {
            score: 1
          }
        }
      },
      bar: {
        content: {
          b: {
            score: 2
          }
        }
      },
      baz: {
        content: {
          c: {
            score: 3
          }
        }
      }
    };
    var x;

Test runner

Ready to run.

Testing in
TestOps/sec
saving a key name
for (var key in data) {
  var key_name = key;
  for (key2 in data[key_name].content) {
    alert(data[key_name].content[key2].score);
  }
}
ready
making checkpoint objects for every parent node
for (var key in data) {
  var obj = data[key];
  for (key2 in obj.content) {
    var inner_obj = obj.content;
    alert(inner_obj[key2].score);
  }
}
ready

Revisions

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

  • Revision 1: published by Matt Ball on
  • Revision 2: published by Göran Andersson on
  • Revision 3: published by Nepoxx on
  • Revision 9: published on