YUI v3.8.0 vs. jQuery v1.8.2 vs Dojo 1.8.0 DOM queries
JavaScript performance comparison
Info
Fixed issues with the tests which causes incorrect results:
All but the native selector were not actually selecting anything since they were just querying the index.
dojo test was returning the query object rather then actually executing the callback block
Rev.47:
Updated YUI to v3.8.0
Changed to use Y.all, which is consistent with other implementations.
Made more fair to YUI by calling .use() once and storing it, as opposed to previous behavior which caused .use() to be called on every benchmark sample. (Someone else might want to do the same for Dojo; it looks like it's being required on every sample as well.)
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://yui.yahooapis.com/3.8.0/build/yui/yui-min.js"></script>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.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>
Benchmark.prototype.setup = function() {
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'], Y = YUI().use('node');
};
</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.8.2 |
|
pending… |
YUI v3.8.0 |
|
pending… |
Dojo 1.8 |
|
pending… |
querySelectorAll |
|
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
0 comments