javascript associative vs non-associative arrays
JavaScript performance comparison
Preparation code
<script>
var arr = [];
var asc = {};
var asd = {};
var ase = [];
var asf = [];
var asg0 = 0, asg1 = 1, asg2 = 2;
arr[0] = 0;
arr[1] = 1;
arr[2] = 2;
asc.i0 = 0;
asc.i1 = 1;
asc.i2 = 2;
asd.a = 0;
asd.b = 1;
asd.c = 2;
ase['i0'] = 0;
ase['i1'] = 1;
ase['i2'] = 2;
asf['a'] = 0;
asf['b'] = 1;
asf['c'] = 2;
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Object access with numbers |
|
pending… |
Object Access without numbers |
|
pending… |
Associative Array with numbers |
|
pending… |
Associative Array without numbers |
|
pending… |
Array access |
|
pending… |
Variable access |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published by Levi Morrison
- Revision 2: published
- Revision 3: published
- Revision 8: published by Erik Oey
- Revision 10: published
- Revision 11: published
- Revision 12: published
- Revision 13: published
- Revision 14: published
- Revision 15: published
- Revision 16: published
- Revision 17: published
- Revision 18: published
- Revision 19: published
- Revision 20: published
- Revision 21: published
- Revision 22: published
- Revision 23: published
- Revision 24: published
- Revision 25: published
- Revision 27: published
- Revision 28: published
- Revision 29: published
- Revision 30: published by Jack Pattishall
- Revision 32: published
- Revision 33: published
- Revision 34: published
- Revision 36: published
0 comments