Iterating though array vs object of array values
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var a = [1, 2, 3, 4, 5, 6, 7];
var b = {a: [1], b: [2], c: [3], d: [4], e: [5], f: [6], g: [7]};
var sum = 0, i, j, len;
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
array |
|
pending… |
object of arrays |
|
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 Mourner
- Revision 2: published by jfgirard
0 comments