jquery vs dojo selector

JavaScript performance comparison

Revision 46 of this test case created


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

Preparation code

<script src="http://code.jquery.com/jquery-1.8.3.min.js">
 <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8.2/dojo/dojo.js"></script>

  <div class="testlink">
    <a href="#" id="linkone" title="test">test link</a>
  <div class="testmenu">
      <li class="menuitem itemone">
        <a href="#" title="item 1">menu item 1</a>
      <li class="menuitem itemtwo">
        <a href="#" title="item 2">menu item 2</a>
      <li class="menuitem itemthree">
        not clickable item 3
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'];

Preparation code output

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 v1.8
for (var sel in selectors) {
Dojo 1.8
require(["dojo/query!css3"], function(query) {
  for (var sel in selectors) {

Compare results of other browsers


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:


Comment form temporarily disabled.

Add a comment