Array Performance (v166)

Revision 166 of this benchmark created on


Description

Manual array lookups vs. holey arrays.

Setup

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

Test runner

Ready to run.

Testing in
TestOps/sec
Manual Array Lookup
for (i = 100; i < 900; i++) {
  var result = a1[i];
}
ready
Holey Array by Index
for (i = 100; i < 900; i++) {
  var result = a1[i];
}
ready
Object by Key
for (i = 100; i < 900; 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.