YUI v3.4.1 vs. jQuery v1.6.4 DOM queries (v2)

Revision 2 of this benchmark created by Jesse Cravens on


Preparation HTML

<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js">
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.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>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery v1.6.4
for (var sel in selectors) {
  $(sel);
}
ready
YUI v3.4.1
YUI().use('node', function(Y) {
  for (var sel in selectors) {
    Y.one(sel);
  }
});
ready

Revisions

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