YUI v3.4.1 vs. jQuery v1.7.4 DOM queries
JavaScript performance comparison
Preparation code
<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js">
</script>
<script src="http://code.jquery.com/jquery-1.7.min.js">
</script>
<div id="test">
<div class="testlink">
<a href="#" id="linkone" title="test">test link</a>
</div>
<div class="testmenu">
<ul>
<li class="menuitem itemone">
<a href="#" title="item 1">menu item 1</a>
</li>
<li class="menuitem itemtwo">
<a href="#" title="item 2">menu item 2</a>
</li>
<li class="menuitem itemthree">
not clickable item 3
</li>
</ul>
</div>
</div>
<script>
var selectors = ['body', 'div', 'body div', 'div a', 'div > a', 'div[class^=test]', 'div, li, a', '.menuitem', 'li.menuitem', '#linkone', 'div#test', 'a[title*=item]', 'a[title=test]', 'li:nth-child(even)', 'li:nth-child(odd)', 'li:last-child', 'li:first-child'];
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
jQuery v1.7 |
|
pending… |
YUI v3.4.1 |
|
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 Jesse Cravens
- Revision 2: published by Jesse Cravens
- Revision 3: published by Jesse Cravens
- Revision 5: published
- Revision 6: published by Mauno
- Revision 7: published by Jamie Pratt
- Revision 8: published
- Revision 11: published by Mauno
- Revision 13: published by Christoph
- Revision 15: published by Christoph
- Revision 16: published by Christoph
- Revision 18: published by Christoph
- Revision 20: published
- Revision 21: published by Mickey Mart
- Revision 22: published
- Revision 23: published by westworld
- Revision 24: published by CTPAx
- Revision 25: published by Kevin
- Revision 26: published
- Revision 27: published
- Revision 28: published by CTPAX
- Revision 29: published
- Revision 30: published by Kevin
- Revision 31: published by thantoldo
- Revision 32: published
- Revision 33: published by opalfroot
- Revision 34: published by KDO
- Revision 36: published
- Revision 37: published by SavvaP
- Revision 40: published by Andrew
- Revision 41: published
- Revision 42: published
- Revision 44: published by vivek
- Revision 45: published
- Revision 46: published
- Revision 47: published by YUI-fix
- Revision 48: published
- Revision 49: published
- Revision 50: published by Jacob
- Revision 51: published
1 comment
Test is not objective. Look, for YUI test code part every iteration executing YUI().use('node'), which is creating new YUI instance with own namespase and make request to yui CDN for loading "node" module.
So, you can imagine how many time it tooks to create instance and make request to receive answer from CDN...