gffor

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var arr = [2, 1, 0, "", "abc", null, [],
    {},
    undefined, 100];
};
</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
#1
for (var i = 0, j = arr.length; i < j; i++) {
  console.log(arr[i]);
}
pending…
#2
for (var i = 0, j, k; k = arr[i], j = k || typeof k != "undefined"; i++) {
  console.log(k);
}
pending…
#3
for (var i = 0; i in arr; i++) {
  console.log(arr[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