Single vs. Multiple jQuery Append (v8)

Revision 8 of this benchmark created on


Description

You can chain $.append(foo).append(bar).append(baz); in jQuery but is there a performance gain by doing the append() in a single step?

WARNING This currently crashes in some browsers... give it all the free CPU you can.

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<table id="myTable"></table>

Test runner

Ready to run.

Testing in
TestOps/sec
Single Append
$('#myTable').append('<tr><td>my data</td><td>more data</td></tr>');
ready
Multiple Appends
$("#myTable")
    .append('<tr></tr>')
        .append('<td>my data</td><td>more data</td>');
 
ready

Revisions

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