Single vs. Multiple jQuery Append (v4)

Revision 4 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?

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
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.