Simple InnerHTML vs DOM

Benchmark created on


Preparation HTML

<div id="innerhtmlvsdomdiv" style="display: none;"></div>
<script>
  div = document.getElementById('innerhtmlvsdomdiv');
  
  function innerhtmlfunction() {
    div.innerHTML += '<div>lol</div>';
  }
  
  function domfunction() {
    newDiv = document.createElement('div');
    newDiv.innerHTML = 'lol';
    div.appendChild(newDiv);
  }
</script>

Teardown


    document.getElementById('innerhtmlvsdomdiv').innerHTML = '';
  

Test runner

Ready to run.

Testing in
TestOps/sec
innerHTML
innerhtmlfunction();
ready
DOM
domfunction();
ready

Revisions

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