out of dom vs documentfragment (v10)

Revision 10 of this benchmark created by fbender on


Description

moved innerHTML crap from previous revisions to teardown.

Preparation HTML

<div id="list1">
</div>
<div id="list2">
</div>

Teardown


    document.getElementById('list1').innerHTML = '';
    document.getElementById('list2').innerHTML = '';
  

Test runner

Ready to run.

Testing in
TestOps/sec
out of dom
var list = document.getElementById('list1');

for (var i = 0; i < 500; i++) {
  a = document.createElement('a');
  a.innerText = 'link ' + i;
  a.style.display = 'block';
  list.appendChild(a);
}
ready
documentfragment
var list = document.getElementById('list2'),
    frag = document.createDocumentFragment();

for (var i = 0; i < 500; i++) {
  a = document.createElement('a');
  a.innerText = 'link ' + i;
  a.style.display = 'block';
  frag.appendChild(a);
}

list.appendChild(frag);
ready

Revisions

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