jQuery vs Sizzle vs Midori vs YUI vs Peppy vs Dojo vs XUI vs Native - selectors test

JavaScript performance comparison

Revision 33 of this test case created

Info

Selectors test of 9 useful javascript frameworks

Preparation code

<script src="//xui-js.googlecode.com/files/xui-core-1.0.0.js">
</script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js">
</script>
<script src="//jamesdonaghue.com/static/peppy/peppy-min.js">
</script>
<script src="//www.midorijs.com/midori.js">
</script>
<script src="//yui.yahooapis.com/2.9.0/build/yahoo/yahoo-min.js">
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/prototype/1/prototype.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/mootools/1.3/mootools-yui-compressed.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/yui/2.9.0/build/yuiloader/yuiloader-min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/ext-core/3/ext-core.js"></script>
<script src="//www.cinsoft.net/mylib099-min.js"></script>
://yui.yahooapis.com/3.4.1/build/yui/yui-min.js">
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js">
</script>
<script>
  var j4 = jQuery.noConflict();
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.2/jquery.min.js">
</script>
<script>
  var j2 = jQuery.noConflict();
</script>
<script src="//linkedin.com/lib/sizzle/1.0/sizzle.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'],
      selectorsLength = selectors.length,
      index;
  dojo.require('dojo.query');
</script>

Preparation code output

://yui.yahooapis.com/3.4.1/build/yui/yui-min.js">

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
jQuery 1.4 (with Sizzle)
for (index = 0; index < selectorsLength; ++index) {
  j4(selectors[index]);
}
pending…
jQuery 1.2 (no Sizzle)
for (index = 0; index < selectorsLength; ++index) {
  j2(selectors[index]);
}
pending…
Sizzle
for (index = 0; index < selectorsLength; ++index) {
  Sizzle(selectors[index]);
}
pending…
Midori
for (index = 0; index < selectorsLength; ++index) {
  midori.get(selectors[index]);
}
pending…
YUI
for (index = 0; index < selectorsLength; ++index) {
  YAHOO.util.Selector.query(selectors[index]);
}
pending…
Peppy
for (index = 0; index < selectorsLength; ++index) {
  peppy.query(selectors[index]);
}
pending…
Dojo
for (index = 0; index < selectorsLength; ++index) {
  dojo.query(selectors[index]);
}
pending…
XUI
for (index = 0; index < selectorsLength; ++index) {
  x$(selectors[index]);
}
pending…
Native
for (index = 0; index < selectorsLength; ++index) {
  document.querySelectorAll(selectors[index]);
}
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:

0 comments

Add a comment