Array Performance

JavaScript performance comparison

Revision 47 of this test case created by

Preparation code

<script>
  Benchmark.prototype.setup = function() {
    var a1 = [];
    var o1 = {};
    for (var i = 0; i < 1000; i++) {
	      var id = Math.floor(Math.random() * 100000) + 1;

if(i===500){
a1.push("TEST");
	      o1.TEST = "TEST";
}

	      a1.push(id);
	      o1.id = id;

    }


  };
</script>
    

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Manual Array Lookup
var id = "TEST";
for (var i = 0; i < a1.length; i++) {
  if (a1[id] !== undefined) break;
}
pending…
indexOf
a1.indexOf("TEST");
pending…
Object by Key
if( o1["TEST"] !== undefined){

}
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL.

0 Comments