Loops

JavaScript performance comparison

Revision 280 of this test case created by

Preparation code

<script>
  var arr10 = new Array(10);
var arr100 = new Array(100);
var arr1000 = new Array(1000);
</script>
    

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
reversed for loop on array(100)
const l = arr100.length
for (var i = arr100.length - 1; i>=0; --i){

}
pending…
standard for loop on array(100)
for (var i = 0; i<arr100.length; ++i){

}
pending…
reversed for loop on array(100) with length cached
const l = arr100.length
for (var i = l - 1; i>=0; --i){

}
pending…
length cached for loop on array(1000)
const l = arr100.length
for (var i = 0; i<l; ++i){

}
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.

0 Comments