Increment decrement for loop

JavaScript performance comparison

Revision 2 of this test case created


Which is faster, increment or decrement for loop

Preparation code

<ul class="list">

<script src=""></script>
Benchmark.prototype.setup = function() {
    var list = $('.list');

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
increment for loop
var i=0;
var sum=0;
var temp = null;
for (; i < 1000; i++) {
   //sum +=i;
   temp = "";
decrement for loop
var i=1000;
var sum=0;
var temp = null;
while(i>0) {
   //sum +=i;
   temp = "";

Compare results of other browsers


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:


Comment form temporarily disabled.

Add a comment