loop descendening

JavaScript performance comparison

Test case created by KooiInc

Info

check if --i>=0 is faster then i--

Preparation code

<script>
  var arr = (function() {
   var i = 0,
       ret = [];
   while (i++ < 100000) {
    ret[i] = i;
   }
   return ret;
  })();
</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--
var i = arr.length,
    j;
while (i--) {
 j = i;
}
pending…
--i>=0
var i = arr.length,
    j;
while (--i >= 0) {
 j = 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