createElement vs cloneNode

Benchmark created on


Preparation HTML

<div id="some">
lorem
</div>
<script>
  var doc = document,
      div = doc.getElementById('some'),
      div2;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
createElement
div2 = doc.createElement('div');

div2.innerHTML = div.innerHTML;
ready
cloneNode
div2 = div.cloneNode(true);
ready

Revisions

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