null-or-undefined

JavaScript performance comparison

Test case created by Don Griffin

Info

Test value for null or undefined

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var nullVal = null,
        undefVal,
        intVal = 42,
        stringVal = 'foo';
   
};
</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
Use === and || on null
nullVal === null || nullVal === undefined
pending…
Use === and || on undefined
undefVal === null || undefVal === undefined
pending…
Use === and || on int
intVal === null || intVal === undefined
pending…
Use === and || on string
stringVal === null || stringVal === undefined
pending…
Use == on null
nullVal == null
pending…
Use == on undefined
undefVal == null
pending…
Use == on int
intVal == null
pending…
Use == on string
stringVal == null
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