Qwery vs Sizzle

JavaScript performance comparison

Revision 6 of this test case created and last updated


Checking perf for basic selectors. Each revision will contain different tests.

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 id="attr-test1"></div>
<div id="attr-test2"></div>
<div id="attr-test3" class="found you" title="whatup duders"></div>
  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];

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
Qwery .a, em
el.className = "b " + cn + (++c);
Q('.' + cn + c + ', em');
Sizzle .a, em
el.className = "b " + cn + (++c);
S('.' + cn + c + ', em');
NWMatcher .a, em
el.className = "b " + cn + (++c);
N('.' + cn + c + ', em');

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