jQuery append vs html vs innerHTML list performance (v82)

Revision 82 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<div id="list" style="display:none;height:0;overflow:hidden;">

Setup

var len = 10;

Test runner

Ready to run.

Testing in
TestOps/sec
jquery .append()
var html = $("<div/>");

for (var i = 0; i < len; i++) {
  html.append($('<div>Test ' + i + '</div>'));
}

$('#list').append(html);
ready
jQuery .html()
var list = document.getElementById('list');
var div = document.createElement("div");
for (var i = 0; i < len; i++) {
  div.appendChild(document.createTextNode("Test " + i));
}
list.appendChild(div);
ready

Revisions

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