innerHTML-vs-createElement (v10)

Revision 10 of this benchmark created on


Preparation HTML

<div id="container"></div>

Setup

var container = document.getElementById('container');

Test runner

Ready to run.

Testing in
TestOps/sec
innerHTML
container.innerHTML = '<div class="test" id="test">Test</div>';
ready
createElement
container.replaceChildren();
var div = document.createElement('div');
div.classList.add("test");
div.id = "test";
div.textContent = "Test";
container.appendChild(div);
ready

Revisions

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