HTML Preparation code:
AخA
 
1
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
2
<table id="tbl">
3
  <tbody></tbody>
4
</table>
Script Preparation code:
x
 
var table = $('#tbl'),
    tbody = table.find('tbody');
var data = { one: 'one', two: 'two', three: 'three', four: 'four', five: 'five' };
Tests:
  • createElement

     
    var tr = $(document.createElement('tr'));
    var td = $(document.createElement('td'));
    td.text(data.one).append(td);
    td = $(document.createElement('td'));
    td.text(data.two).append(td);
    var td = $(document.createElement('td'));
    td.text(data.three).append(td);
    var td = $(document.createElement('td'));
    td.text(data.four).append(td);
    var td = $(document.createElement('td'));
    td.text(data.five).append(td);
    tbody.append(tr);
  • Append HTML

     
    var html = '<tr>';
    html += '<td>'+data.one+'</td>';
    html += '<td>'+data.two+'</td>';
    html += '<td>'+data.three+'</td>';
    html += '<td>'+data.four+'</td>';
    html += '<td>'+data.five+'</td>';
    html += '</tr>';
    tbody.append(html);
  • Combination

     
    var tr = $(document.createElement('tr'));
    tr.append('<td>'+data.one+'</td>');
    tr.append('<td>'+data.two+'</td>');
    tr.append('<td>'+data.three+'</td>');
    tr.append('<td>'+data.four+'</td>');
    tr.append('<td>'+data.five+'</td>');
    tbody.append(tr);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    createElement
    Append HTML
    Combination

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Chrome 111 on Windows
View result in a separate tab
Test name Executions per second
createElement 26217.0 Ops/sec
Append HTML 22289.4 Ops/sec
Combination 6301.9 Ops/sec