soonwtf123

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var map = {
       "ab": "ok1",
       "ac": "ok2",
       "ad": "ok3",
       "ae": "ok4",
       "af": "ok5",
       "ag": "ok6",
       "ah": "ok7",
       "ai": "ok8",
       "aj": "ok9",
       "ak": "ok10",
       "al": "ok11",
       "am": "ok12",
       "an": "ok13"
    };
   
    var thing = "ai";
};
</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
map
if (map[thing]) {

}
pending…
if else
if (thing === "ab") {

}else if (thing == "ac") {

}else if (thing == "ad") {

}else if (thing == "ae") {

}else if (thing == "af") {

}else if (thing == "ag") {

}else if (thing == "ah") {

}else if (thing == "ai") {

}else if (thing == "aj") {

}else if (thing == "ak") {

}else if (thing == "al") {

}else if (thing == "am") {

}else if (thing == "an") {

}
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