Qwery vs Sizzle

JavaScript performance comparison

Revision 26 of this test case created

Info

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

Preparation code

<script src="http://s3.amazonaws.com/nwapi/nwmatcher/nwmatcher-1.2.5-min.js"></script>
<script src="https://raw.github.com/jquery/sizzle/master/sizzle.js"></script>
<script src="//github.com/ded/qwery/raw/master/qwery.js"></script>
<script src="http://sett.bplaced.net/other/Sen/Sen.perf.min.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() {
NW.Dom.configure( { USE_QSAPI: false } );
  };
   var N = NW.Dom.select,
       Q = qwery,
       S = Sizzle,
       c = 0,
       s = select,
       id = "boosh" + (Benchmark.count += this.count),
       el = document.getElementById('boosh');
Q.configure({
  useNativeQSA: false
});

 
  Benchmark.prototype.teardown = function() {
   el.id = 'boosh';
  };
</script>

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 div
el.id = id + (++c);
Q('div, #' + id + c);
pending…
Sizzle div
el.id = id + (++c);
S('div, #' + id + c);
pending…
NWMatcher div
el.id = id + (++c);
N('div, #' + id + c);
pending…
Sen div
el.id = id + (++c);
s('div, #' + id + c);
pending…
querySelector div
el.id = id + (++c);
document.querySelector('div, #' + id + 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. Here’s a list of current revisions for this page:

0 comments

Add a comment