Basic DOM manipulation (v4)

Revision 4 of this benchmark created by Gabriel R. Giannattasio on


Preparation HTML

<div id="container"></div>

Setup

var div = document.createElement('div'),
         p = document.createElement('p'),
         el = document.getElementById('container');

Teardown



            el.innerHTML = '';
        
  

Test runner

Ready to run.

Testing in
TestOps/sec
Only one DOM write
div.appendChild(p);
el.appendChild(div);
ready
Two DOM writes
el.appendChild(div);
div.appendChild(p);
ready

Revisions

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

  • Revision 1: published by Mathias Bynens on
  • Revision 2: published by Mathias Bynens on
  • Revision 4: published by Gabriel R. Giannattasio on