typeof vs prop
JavaScript performance comparison
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.
| Test | Ops/sec | |
|---|---|---|
typeof obj |
|
pending… |
typeof num |
|
pending… |
typeof obj 2 |
|
pending… |
property |
|
pending… |
ind |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments