typeof vs "in" object keyword
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var obj = { dev: 2114,
ino: 48064969,
mode: 33188,
nlink: 1,
uid: 85,
gid: 100,
rdev: 0,
size: 527,
blksize: 4096,
blocks: 8,
atime: "Mon, 10 Oct 2011 23:24:11 GMT",
mtime: "Mon, 10 Oct 2011 23:24:11 GMT",
ctime: "Mon, 10 Oct 2011 23:24:11 GMT" };
var t = 0;
var i = 0;
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
typeof |
|
pending… |
in |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published
0 comments