innerHTML vs createElement, appendChild

Benchmark created by Alejandro on


Test runner

Ready to run.

Testing in
TestOps/sec
innerHTML
var ul = document.createElement('ul');
ul.innerHTML ="<li></li><li></li><li></li><li></li>";
 
ready
createElement, appendChild
var 
ul = document.createElement('ul'),
li_1 = document.createElement('li'),
li_2 = document.createElement('li'),
li_3 = document.createElement('li'),
li_4 = document.createElement('li');
ul.appendChild(li_1);
ul.appendChild(li_2);
ul.appendChild(li_3);
ul.appendChild(li_4);
ready

Revisions

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