Qwery vs Sizzle vs Minimal (v15)

Revision 15 of this benchmark created on


Description

Tests handling the most basic selectors between qwery, sizzle, and minimal. Qwery and sizzle are both wonderful, but minimal is for those who want to always use only the most performant selectors. It forces you to do this by limiting the kinds of selectors it will treat. For instance, descendants are not allowed (e.g. '#parent #child'), nor css3 selectors, which is significantly slower than id, tag, or class (that is where getElementsByClassName is supported). qwery and sizzle will prefer these fast methods, but will do more checks and function calls. The ambition behind minimal is to create the fastest selector engine possible, even if it can't do everything.

Preparation HTML

<script src="https://github.com/jquery/sizzle/raw/master/sizzle.js"></script>
<script src="https://github.com/ded/qwery/raw/master/qwery.js"></script>
<script src="https://raw.github.com/timmywil/minimal/master/src/minimal.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>

Setup

Benchmark.count = 0;
  Benchmark.prototype.setup = function() {
   var Q = qwery,
       S = Sizzle,
       QA = queryAll;
  };

Test runner

Ready to run.

Testing in
TestOps/sec
Qwery .d
Q('.d');
ready
Sizzle .d
S('.d');
ready
Minimal .d
QA('.d');
ready
Qwery #boosh
Q('#boosh')
ready
Sizzle #boosh
S('#boosh')
ready
Minimal #boosh
QA('#boosh')
ready
Query div
Q('div')
ready
Sizzle div
S('div')
ready
Minimal div
QA('div')
ready
Qwery div.a
Q('div.a')
ready
Sizzle div.a
S('div.a')
ready
Minimal div.a
QA('div.a')
ready
Qwery div.a, .d
Q('div.a, .d')
ready
Sizzle div.a, .d
S('div.a, .d')
ready
Minimal div.a, .d
QA('div.a, .d')
ready
Qwery .noexist
Q('.noexist')
ready
Sizzle .noexist
S('.noexist')
ready
Minimal .noexist
QA('.noexist')
ready
Qwery #noexist
Q('#noexist')
ready
Sizzle #noexist
S('#noexist')
ready
Minimal #noexist
QA('#noexist')
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.