While vs For (Round 365798635789365963758)

JavaScript performance comparison

Test case created

Info

Lero lero

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var days = ['lunes', 'martes', 'miercoles', 'jueves', 'viernes', 'sabado', 'domingo'];
};
</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
While
var i = days.length;
var k = 2;

while (k--) {
  while (i--) {
    console.log(days[i - 1]);
  }
}
pending…
For
var len = days.length;
var k = 2;

while (k--) {
  for (var i = 0; i < len; i++) {
    console.log(days[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