jQuery .add() Performance 123 (v16)

Revision 16 of this benchmark created by Dmitry on


Preparation HTML

<script src="http://code.jquery.com/jquery-1.4.2.js"></script>
<script>var jq142 = jQuery.noConflict();</script>
<script src="http://code.jquery.com/jquery-1.6.js"></script>
<script>var jq16 = jQuery.noConflict();</script>
<script src="http://code.jquery.com/jquery-git.js"></script>
<script>var jqgit = jQuery.noConflict();</script>
<div style="display:none;">
<ul>
<li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li>
</ul>
<div>
<span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span>
</div>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
1.4.2 .add()
jq16("span").add("li").addClass('cool-class');
ready
1.6 .add()
// async test
jq16("span").addClass('cool-class');
jq16("li").addClass('cool-class');
ready
Git .add()
jqgit("span").add("li");
ready
array attempt
b = jq142.makeArray(jq142("span"));
a = jq142.makeArray(jq142("li"));

b.push.apply(b, a);
$b = jq142(b);
ready

Revisions

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