Array access

JavaScript performance comparison

Test case created by Szalonna

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var accArray = [];
        maxnum = 100000;
    for(var i = 0; i < maxnum; i++){
      accArray["id"+i] = "testing"+i;
    }
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Numeric access
for(var i = 0; i < maxnum; i++){
  var id = "id" +i,       // for to test just the array accessing time
      item = accArray[i];
}
pending…
Assoc access
for(var i = 0; i < maxnum; i++){
  var id = "id"+i,
      item = accArray[id];
}
pending…

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

Compare results of other browsers

0 comments

Add a comment