Find vs Filter vs Traverse
JavaScript performance comparison
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<ul id="top">
<li>
<div>
bbb
<span name="test">
a
</span>
</div>
</li>
<li>
<div>
bbb
<span name="test">
a
</span>
</div>
</li>
<li style="display:none;">
<div>
bbb
<span name="test">
a
</span>
</div>
</li>
</ul>
<script>
var value;
</script>
Preparation code output
-
bbb a
-
bbb a
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Find |
|
pending… |
Filter |
|
pending… |
Traverse one children |
|
pending… |
Traverse 2 children |
|
pending… |
Traverse children, no name search |
|
pending… |
Traverse 2 children, no name search |
|
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 Vuly
- Revision 2: published
0 comments