testing for options

JavaScript performance comparison

Test case created by Adam Drago

Info

This test compares 3 ways of testing whether an options object is present.

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    function check1(options) {
    if (options) { }
    }
   
    function check2(options) {
    if (options != undefined) {}
    }
   
    function check3(options) {
    if (options !== undefined) {}
    }
};
</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
check1
check1();
pending…
check2
check2();
pending…
check3
check3();
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