Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
innerHTML vs innerText vs textContent (full)
(version: 1)
blah blah
Comparing performance of:
innerText vs innerHtml vs textContent
Created:
10 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");
Tests:
innerText
let i = 1000; let el = document.querySelector("#hello"); while (i--) { el.innerText = "Goodbye, cruel world!" }
innerHtml
let i = 1000; let el = document.querySelector("#hello"); while (i--) { el.innerHtml = "Goodbye, cruel world!" }
textContent
let i = 1000; let el = document.querySelector("#hello"); while (i--) { el.textContent = "Goodbye, cruel world!" }
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:
10 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser/OS:
Chrome 137 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
innerText
3382.2 Ops/sec
innerHtml
1467851.0 Ops/sec
textContent
3632.2 Ops/sec
Related benchmarks:
innerHTML vs innerText vs textContent
innerText vs textContent vs innerHTML
setting innerHTML vs innerText vs textContent
innerHTML vs innerText vs custom
innerHTML vs innerText vs textContent 2
innerHTML vs innerText vs textContent 3
innerHTML vs innerText vs textContent Setting
innerHTML vs innerText vs textContent ..
innerHTML vs innerText vs textContent with lower i
Comments
Confirm delete:
Do you really want to delete benchmark?