Single vs. Multiple jQuery Append (v5)

Revision 5 of this benchmark created by Stephen 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="https://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
var str = '<tr><td>my data</td><td>more data</td></tr>';
$('#myTable').append(str);
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.