clone vs. template (v9)

Revision 9 of this benchmark created by Vladimir on


Preparation HTML

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

Setup

var dom_template = $(document.createElement('div'));
  dom_template.addClass('test');
  var html = $(document.body);

Test runner

Ready to run.

Testing in
TestOps/sec
clone
var o = dom_template.clone();
html.append(o);
o.remove();
ready
template
var o = $(document.createElement('div'));
o.addClass('test');
html.append(o);
o.remove();
ready
text
var o = $('<div class="test"></div>');
html.append(o);
o.remove();
ready

Revisions

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