Test

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var s = '';
    var a2 = {};
    for (var i=0; i<10000; i++) {
        if (s) {
            s += ' ';
        }
        s += i;
        a2[i] = i;
    }
    var a1 = s.split(' ');
};
</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
Test1
var count = 0;
for(var i = 1; i < 10000; i++) {
      if(a1[i]) {
          count++;
      }
}
pending…
Test2
var count = 0;
for(var i = 1; i < 10000; i++) {
      if(a2[i]) {
          count++;
      }
}
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