jQuery vs Sizzle vs Midori vs Mootools vs YUI vs Peppy vs Selector.js vs Selectors API - selectors test (v2)

Revision 2 of this benchmark created on


Description

Selectors test of 7 lightweight javascript frameworks and Selectors API.

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script>jQuery.noConflict();</script>
<script src="//linkedin.com/lib/sizzle/1.0/sizzle.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.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>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery
for (var sel in selectors) {
 jQuery(sel);
}
ready
Sizzle
for (var sel in selectors) {
 Sizzle(sel);
}
ready
Midori
for (var sel in selectors) {
 //midori.get(sel);
}
ready
Mootools
for (var sel in selectors) {
 // jQuery(sel);
}
ready
YUI
YUI().use('node', function(Y) {
 for (var sel in selectors) {
  //  Y.all(sel);
 }
});
ready
Peppy
for (var sel in selectors) {
 // peppy.query(sel);
}
ready
Selector.js
for (var sel in selectors) {
 // Selector(sel);
}
ready
Selectors API
for (var sel in selectors) {
 // document.querySelectorAll(sel);
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.