RightJS vs. YUI3 vs. jQuery vs. Sizzle vs. Peppy vs. Native selector test (v24)

Revision 24 of this benchmark created on


Description

Native case: * Reference matches after loop because a real function would need to return that. * Resubmiteed; DSL + 2Wire drops packets.

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://yui.yahooapis.com/3.2.0pr1/build/yui/yui-min.js"></script>
<script src="http://github.com/jeresig/sizzle/raw/master/sizzle.js"></script>
<script src="http://jamesdonaghue.com/static/peppy/peppy-min.js"
</script>
<script src="http://rightjs.org/hotlink/right-1.5.6.js"
</script>

<section class="target-me" name="donuts">.target-me</section>
<section class="target-me">.target-me</section>
<section class="target-me" name="candy">.target-me</section>
<script>
  jQuery.noConflict();
  Y = YUI().use('node');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery
jQuery('.target-me[name=candy]');
ready
YUI3
Y.all('.target-me[name=candy]');
ready
Sizzle
Sizzle('.target-me[name=candy]');
ready
Peppy
peppy.query('.target-me[name=candy]');
ready
Native
var elements = document.getElementsByClassName('target-me'),
    i, j, len = elements.length,
    matches = [],
    e;

for (i = j = 0; i < len; ++i) {
 e = elements[i];
 if (e.getAttribute('name') === 'candy') {
  matches[j++] = e;
 }
}
matches;
ready
Native Query Selector
document.querySelectorAll('.target-me[name=candy]');
ready
RightJS 1.5.6
$$('.target-me[name=candy]');
ready

Revisions

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