DOM vs innerHTML (v30)

Revision 30 of this benchmark created on


Description

Fine tuning the DOM method to yield better performance for this particular synthetic test. (alternate method without cloning)

Preparation HTML

<div id="main_node"></div>
<script>
  var node = document.getElementById('main_node'),
      fragment = document.createDocumentFragment();
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
DOM

node.appendChild(document.createElement('div'));


node.removeChild(node.firstChild);
ready
innerHTML
node.innerHTML = '<div></div>';

node.innerHTML = '';
ready

Revisions

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