IndexOfobject

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var array =[];
    var object = {};
    for (var i=0, l= 2000; i<l; i++) {
      array.push(Math.random());
      object[Math.random()+""] = "something";
    }
    object["0.5640371285844594"] = "something";
    array.push(0.5640371285844594+"");
};
</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
IndexOf
if ( array.indexOf("0.5640371285844594") != -1 ) {
//something
}
pending…
Object
if ( object["0.5640371285844594"] ){
//something
}
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