Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Performance when getting innerHTML vs innerText vs textContent
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:147.0) Gecko/20100101 Firefox/147.0
Browser:
Firefox 147
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
6 months ago
innerHtml
2.1M/s
textContent
9K/s
innerText
247/s
View exact numbers
Test name
Executions per second
✓
innerHtml
2,110,326 Ops/sec
textContent
8,762 Ops/sec
innerText
247 Ops/sec
HTML Preparation code:
<div id='hello'>Hello, World!</div>
Script Preparation code:
let el = document.querySelector("#hello"); for(let i=0;i<10;i++) { el.innerText = el.innerText + el.innerText; }
Tests:
innerText
let i = 100; let el = document.querySelector("#hello"); let thing = ''; while (i--) { thing += el.innerText; }
innerHtml
let i = 100; let el = document.querySelector("#hello"); let thing = ''; while (i--) { thing += el.innerHtml; }
textContent
let i = 100; let el = document.querySelector("#hello"); let thing = ''; while (i--) { thing += el.textContent; }