documentFragment appendChild vs jquery append (v16)

Revision 16 of this benchmark created on


Preparation HTML

<div id="test-area" style="height: 75px; width: auto; overflow:scroll">
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>

Teardown


    $('#test-area').empty();
  

Test runner

Ready to run.

Testing in
TestOps/sec
Document Fragment
var raw_fragment = document.createDocumentFragment();

//var i = 10000;
//while (i--) {
  var p = document.createElement("p");
  p.appendChild(document.createTextNode("raw javascript, documentFragment"));
  raw_fragment.appendChild(p);
//}

document.getElementById('test-area').appendChild(raw_fragment);
ready
jQuery
var jq_fragment = [];

//var i = 10000;
//while (i--) {
  jq_fragment.push("<p>jquery elements</p>");
//}

$('#test-area').append(jq_fragment.join(""));
ready

Revisions

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