caching length

JavaScript performance comparison

Revision 76 of this test case created by Array loop

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var arr = [];
    for (var i = 0; i < 1000; i++) {
      arr[i] = Math.random();
    }
   
    function iterator() {
    "use strict";
    for (let it of arr) {
      return it;
    }
    }
   
    function forloop() {
    for (var i = 0; i < arr.length; i++) {
      return arr[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
iterator
iterator()
pending…
not cached
forloop()
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:

0 comments

Comment form temporarily disabled.

Add a comment