YUI v3.4.1 vs. jQuery v1.7 DOM queries

JavaScript performance comparison

Revision 29 of this test case created by

Preparation code

<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js">
</script>
<script src="https://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 = ['.menuitem', 'li.menuitem', '#linkone', 'div#test', 'a[title*=item]', 'a[title=test]'];
  var Y = YUI().use('node-base', 'selector-css3');
  window.Sizzle = jQuery.find;
</script>
    

Preparation code output

<script src="https://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 = ['.menuitem', 'li.menuitem', '#linkone', 'div#test', 'a[title*=item]', 'a[title=test]']; var Y = YUI().use('node-base', 'selector-css3'); window.Sizzle = jQuery.find; </script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
jQuery v1.7
$(selectors[0]);
$(selectors[1]);
$(selectors[2]);
$(selectors[3]);
$(selectors[4]);
$(selectors[5]);
pending…
YUI v3.4.1
Y.all(selectors[0]);
Y.all(selectors[1]);
Y.all(selectors[2]);
Y.all(selectors[3]);
Y.all(selectors[4]);
Y.all(selectors[5]);
pending…
YUI v3.4.1 Selector class
Y.Selector.query(selectors[0]);
Y.Selector.query(selectors[1]);
Y.Selector.query(selectors[2]);
Y.Selector.query(selectors[3]);
Y.Selector.query(selectors[4]);
Y.Selector.query(selectors[5]);
pending…
Sizzle
Sizzle(selectors[0]);
Sizzle(selectors[1]);
Sizzle(selectors[2]);
Sizzle(selectors[3]);
Sizzle(selectors[4]);
Sizzle(selectors[5]);
pending…
YUI v3.4.1 Coma separated
Y.all(selectors);
pending…
jQuery Coma separated
$(selectors);
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.

0 Comments