for..in loop if oh yeah
JavaScript performance comparison
Preparation code
<div id='a'>
</div>
<div id='b'>
</div>
<div id='c'>
</div>
<div id='d'>
</div>
<div id='e'>
</div>
<div id='f'>
</div>
<div id='g'>
</div>
<div id='h'>
</div>
<div id='i'>
</div>
<div id='j'>
</div>
<div id='k'>
</div>
<script>
Benchmark.prototype.setup = function() {
var q = {
a: true,
b: true,
c: false,
d: true,
e: false,
f: false,
g: true,
h: true,
i: false,
j: false,
k: false
}
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
for..in loop |
|
pending… |
bunch of ifs |
|
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 by jack
- Revision 2: published
0 comments