javascript associative vs non-associative arrays (v22)

Revision 22 of this benchmark created on


Preparation HTML

<script>
  var arr = [];
  var asc = {};

  arr[0] = 0;
  arr[1] = 1;
  arr[2] = 2;

  asc.a = 0;
  asc.b = 1;
  asc.c = 2;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Object access with numbers
asc.i0;
asc.i1;
asc.i2;
ready
Object Access without numbers
asd.a;
asd.b;
asd.c;
ready
Associative Array with numbers
ase['i0'];
ase['i1'];
ase['i2'];
ready
Associative Array without numbers
asf['a'];
asf['b'];
asf['c'];
ready
Array access
arr[0];
arr[1];
arr[2];
ready

Revisions

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