Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Performance when setting innerHTML vs innerText vs textContent
(version: 1)
Comparing performance of:
innerText vs innerHtml vs textContent
Created:
3 months ago
by:
Guest
Jump to the latest result
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"); while (i--) { el.innerText += i; }
innerHtml
let i = 100; let el = document.querySelector("#hello"); while (i--) { el.innerHtml += i; }
textContent
let i = 100; let el = document.querySelector("#hello"); while (i--) { el.textContent += i; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
innerText
innerHtml
textContent
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
3 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser/OS:
Chrome 134 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
innerText
5.2 Ops/sec
innerHtml
2641188.2 Ops/sec
textContent
136.0 Ops/sec
Related benchmarks:
innerHTML vs innerText vs textContent
setting innerHTML vs innerText vs textContent
innerHTML vs innerText vs textContent123123
innerHTML vs innerText vs textContent1231232
innerHTML vs innerText vs textContent 3
innerHTML vs innerText vs textContent Retrieval
innerHTML vs innerText vs textContent Setting
innerHTML vs innerText vs textContent with lower i
Performance when getting innerHTML vs innerText vs textContent
Comments
Confirm delete:
Do you really want to delete benchmark?