cloneNode vs createElement Performance (v26)

Revision 26 of this benchmark created on


Description

check speeds with complex element

Preparation HTML

<script> 
function createErrorElement() {
                var errorElement = document.createElement("tr");
                var tableCell_1 = document.createElement("td");
                tableCell_1.setAttribute("class", "formErrors");
                tableCell_1.innerHTML = "&nbsp;";
                var tableCell_2 = document.createElement("td");
                tableCell_2.setAttribute("class", "formErrors");
                var span = document.createElement("span");
                span.setAttribute("class", "errMsg");
                span.appendChild(document.createTextNode('You must specify a value for this field.'));
                tableCell_2.appendChild(span);
                errorElement.appendChild(tableCell_1);
                errorElement.appendChild(tableCell_2);
                return errorElement;
            }
  var errorElement = createErrorElement();
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
clone element
errorElement.cloneNode(true);
ready
create element
createErrorElement()
ready

Revisions

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