jQuery building dom (v2)

Revision 2 of this benchmark created on


Preparation HTML

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

<div id="container"></div>
<script>
  var container = $('#container');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
HTML chunk
container.empty();
var x = $('<div class="black red" data-id="32">In a hole in the ground, there lived a hobbit.</div>');

container.append(x);
ready
Piecewise DOM
container.empty();
var x = $('<div>').addClass("black red").attr("data-id", 32).text("In a hole in the ground, there lived a hobbit.");
ready

Revisions

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