Array Performance (v168)

Revision 168 of this benchmark created on


Description

Manual array lookups vs. holey arrays.

Setup

var a1=[];
var a2={};
for (i=0; i<20000; i=i+10) {
a1[i]=i;
a2[i]=i;
}

Test runner

Ready to run.

Testing in
TestOps/sec
Manual Array Lookup
for (i = 100; i < 19000; i++) {
  var result = a1[i];
}
ready
Holey Array by Index
for (i = 100; i < 19000; i++) {
  var result = a1[i];
}
ready
Object by Key
for (i = 100; i < 19000; i++) {
  var result = a2[i];
}
ready

Revisions

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