comparison operators in "while" loops (2)

JavaScript performance comparison

Test case created by Jörg Schaper

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var A=[];
    var I=1111;
    var i;
    var v;
   
    i=-1;while (++i<I){A[i]=1;}
};
</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
--i>=0
i=I,v=0;while(--i>=0){v+=A[i];}
pending…
--i>-1
i=I,v=0;while(--i>-1){v+=A[i];}
pending…
--i!==-1
i=I,v=0;while(--i!==-1){v+=A[i];}
pending…
--i!=-1
i=I,v=0;while(--i!=-1){v+=A[i];}
pending…
i
i=I,v=0;while(i){v+=A[--i];}
pending…
i>0
i=I,v=0;while(i>0){v+=A[--i];}
pending…
i!==0
i=I,v=0;while(i!==0){v+=A[--i];}
pending…
i!=0
i=I,v=0;while(i!=0){v+=A[--i];}
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