parseHTML vs clone node

Benchmark created on


Setup

window.container = document.createElement('div');
window.svg = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' height='24' width='24'><path d='M12,0A12.24,12.24,0,0,0,3.47,3.65,11.85,11.85,0,0,0,0,12.21,11.78,11.78,0,0,0,11.8,24H12A12.11,12.11,0,0,0,24,11.79h0A11.77,11.77,0,0,0,12,0ZM10.5,16.54A1.48,1.48,0,0,1,12,15h0a1.53,1.53,0,0,1,1.52,1.47A1.47,1.47,0,0,1,12.05,18h0A1.53,1.53,0,0,1,10.5,16.54Zm.5-4v-6a1,1,0,0,1,2,0v6a1,1,0,0,1-2,0Z' fill='currentColor'></path></svg>"
window.svgTemplate = document.createElement('template');
window.svgTemplate.innerHTML = window.svg;

Teardown

window.container = null;
window.svg = null;
window.svgTemplate = null;

Test runner

Ready to run.

Testing in
TestOps/sec
innerHTML
container.innerHTML = svg;
ready
clone node
container.appendChild(window.svgTemplate.content.cloneNode(true));
ready

Revisions

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