html insertion js vs jquery (v6)

Revision 6 of this benchmark created on


Preparation HTML

<div id='test1' style='overflow: scroll; height: 100px'></div>
<div id='test2' style='overflow: scroll; height: 100px'></div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

var content = [];
  for (var i = 0; i < 50; i++) {
    content.push('Hello World');
  }
  content = content.join(' ');

Test runner

Ready to run.

Testing in
TestOps/sec
plain js
var t1 = document.getElementById("test1");
var d = document.createElement("div");
d.innerHTML = content;
t1.appendChild(d);
ready
jquery
var $t2 = $('#test2');
var $d = $('<div></div>');
$d.html(content);
$t2.append($d);
ready

Revisions

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