document.write VS. document.createElement (v7)

Revision 7 of this benchmark created on


Description

A performance comparison of document.write VS document.createElement

Preparation HTML

<div id=foo></foo>

Test runner

Ready to run.

Testing in
TestOps/sec
document.write
 var newHTML = "<div><h1>Hi there!</h1></div>";
 var foo = document.getElementById("foo");
write(newHTML);
ready
document.createElement
 var newDiv = document.createElement("div");
 newDiv.innerHTML = "<h1>Hi there!</h1>";
 var foo = document.getElementById("foo");
 foo.appendChild(newDiv);
ready

Revisions

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