createDocumentFragment vs appendChild on non-appended element (v14)

Revision 14 of this benchmark created on


Description

Justice

Preparation HTML

<form id="fform"></form>
<script>
window.fform = document.getElementById('fform')
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Normal Append
var form = document.createElement('form'),
    array = [
        document.createElement('input'),
        document.createElement('input'),
        document.createElement('input'),
        document.createElement('input')
    ], i;
    
for (i = 0; i < 4; i +=1)
{
    form.appendChild(array[i]);
}
    
window.fform.appendChild(form);
document.body.offsetHeight;
window.fform.removeChild(form);
ready
Document Fragment+Form
var docfrag = document.createDocumentFragment(),
    array = [
        document.createElement('input'),
        document.createElement('input'),
        document.createElement('input'),
        document.createElement('input')
    ], i;

for (i = 0; i < 4; i +=1)
{
    docfrag.appendChild(array[i]);
}
  
window.fform.appendChild(docfrag);
document.body.offsetHeight;
window.fform.innerHTML = '';
ready

Revisions

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