innerHtml

Benchmark created by walter on


Preparation HTML

<div id="wrapper">
  <div id="section"></div>
</div>

Setup

var section = document.getElementById("section"),
        htmlString = "<span>This is span with some String !!!</span>";

Test runner

Ready to run.

Testing in
TestOps/sec
createDocumentFragment
// async test
var frag = document.createDocumentFragment();

for(var i = 0 ; i<=100 ; i+=1){
  content = document.createElement("div");
  content.innerHtml = "<span>" + i + " : </span>";
  frag.appendChild(content);
}
section.appendChild(frag);

 
ready
innerHtml String
// async test
var temp = "";
temp += '<div id ="content">'; 
for(var i = 0 ; i<=100 ; i+=1){
  temp += "<div>";
  temp += "<span>" + i + " : </span>";
  temp += htmlString; 
  temp += "</div>";
}
temp += "</div>";
section.innerHTML =  temp;
ready

Revisions

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