typeof vs prop

JavaScript performance comparison

Test case created by luite

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var x = { t: 1 };
    var y = 1;
    function f() { return 1; };
    f.t = 3;
    var z = { t: f };
};
</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
typeof obj
typeof x === 'object'
pending…
typeof num
typeof y === 'number'
pending…
typeof obj 2
typeof x === 'number'
pending…
property
x.t === 1
pending…
ind
z.t.t === x.t
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