Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Replace text content on DOM element 2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
innerHTML
1975749.8 Ops/sec
textContent
14454660.0 Ops/sec
replaceChildren
3585514.5 Ops/sec
remove & append
3803472.0 Ops/sec
HTML Preparation code:
<div id='target'></div>
Script Preparation code:
let el = document.getElementById("target"); for(i=0; i<10; i++) { el.innerHTML += "<span>Text</span>" }
Tests:
innerHTML
let el = document.getElementById("target"); el.innerHTML = "Some ordinary text"
textContent
let el = document.getElementById("target"); el.textContent = "Some ordinary text"
replaceChildren
let el = document.getElementById("target"); let txt = document.createTextNode("Some ordinary text") el.replaceChildren(txt);
remove & append
let el = document.getElementById("target"); while (el.firstChild) { el.removeChild(el.firstChild); } let txt = document.createTextNode("Some ordinary text") el.appendChild(txt);