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
textContent
14.5M/s
remove & append
3.8M/s
replaceChildren
3.6M/s
innerHTML
2.0M/s
View exact numbers
Test name
Executions per second
✓
textContent
14,454,660 Ops/sec
remove & append
3,803,472 Ops/sec
replaceChildren
3,585,514 Ops/sec
innerHTML
1,975,750 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);