for counters-test

JavaScript performance comparison

Test case created

Info

Let's check how big the difference will between a for loop with a globally defined counter and a for loop with a private counter.

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var x = 0;
};
</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
for-global-counter
for (x; x < 1000; x++) {
 // run
}
pending…
for-private-counter
for (var i = 0; i < 1000; i++) {
 // run
}
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