jQuery vs. Prototype vs. _j (v35)

Revision 35 of this benchmark created on


Description

This is a comparison of selector engine speed between jQuery 2.0.3 and Prototype 1.6.1 and _j 0.4

Curious to see how _j performs

(selector only)

Preparation HTML

<!doctype html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/prototype/1.6.1/prototype.js">
</script>
<script src="//code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://lzacorp.com/_jv0.4/_j.min.js"></script>
<script>
$.noConflict();
        //secondary step post constructor, bypass function checks, regexps and sizzle
        jQuery.fn.$ = function(sel, ctx) {
          if (ctx){//jquery context only
              return ctx.find(selector);
          }
          this.context = this[0] = sel;
                this.length = 1;
                return this;
        };
  //$Q plugin method for jQuery particular to unique results on 'node.class' queries with querySelector (vs querySelectorAll)
        $Q = function(sel,ctx){
          return jQuery().$(document.querySelector(sel), ctx);
        };
</script>


</head>
<body>
<ul id="list">
<li>
<ul class="sublist">
<li>
item1
</li>
<li>
item2
</li>
</ul>
</li>
<li>
<ul class="sublist">
<li>
item1
</li>
<li>
item2
</li>
</ul>
</li><li>
<ul class="sublist">
<li>
item1
</li>
<li>
item2
</li>
</ul>
</li><li>
<ul class="unique">
<li>
item1
</li>
<li>
item2
</li>
</ul>
</li>
</ul>
</body>
</html>

Test runner

Ready to run.

Testing in
TestOps/sec
Prototype
$$("ul.unique");
ready
jquery
jQuery("ul.unique");
ready
_j
_jSel("ul.unique");
ready
$Q
$Q("ul.unique");
ready

Revisions

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