Qwery vs Sizzle

JavaScript performance comparison

Revision 5 of this test case created by and last updated

Preparation code

<script src="https://github.com/dperini/nwmatcher/raw/master/src/nwmatcher.js"></script>
<script src="https://github.com/jquery/sizzle/raw/master/sizzle.js"></script>
<script src="https://github.com/ded/qwery/raw/master/qwery.js"></script>
<div foo="bar"></div>
<div class="a"></div>
<div id="boosh">
  <div class="a b">
    <div class="d e" test="fg" id="booshTest"></div>
    <em test="f g"></em>
    <span class="h i a"></span>
  </div>
</div>
<div id="attr-test1"></div>
<div id="attr-test2"></div>
<div id="attr-test3" class="found you" title="whatup duders"></div>
<script>
  Benchmark.count = 0;
  Benchmark.prototype.setup = function() {
   var N = NW.Dom.select,
       Q = qwery,
       S = Sizzle,
       c = 0,
       cn = "a" + (Benchmark.count += this.count),
       el = document.getElementById('boosh').getElementsByTagName('div')[0];
  };
</script>
    

Preparation code output

<script src="https://github.com/jquery/sizzle/raw/master/sizzle.js"></script> <script src="https://github.com/ded/qwery/raw/master/qwery.js"></script> <div foo="bar"></div> <div class="a"></div> <div id="boosh"> <div class="a b"> <div class="d e" test="fg" id="booshTest"></div> <em test="f g"></em> <span class="h i a"></span> </div> </div> <div id="attr-test1"></div> <div id="attr-test2"></div> <div id="attr-test3" class="found you" title="whatup duders"></div> <script> Benchmark.count = 0; Benchmark.prototype.setup = function() { var N = NW.Dom.select, Q = qwery, S = Sizzle, c = 0, cn = "a" + (Benchmark.count += this.count), el = document.getElementById('boosh').getElementsByTagName('div')[0]; }; </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
Qwery div.a
el.className = "b " + cn + (++c);
Q('div.' + cn + c);
pending…
Sizzle div.a
el.className = "b " + cn + (++c);
S('div.' + cn + c);
pending…
NWMatcher div.a
el.className = "b " + cn + (++c);
N('div.' + cn + c);
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