Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
perf innerHTML vs innerText vs textContent
(version: 1)
blah blah
Comparing performance of:
innerText vs innerHtml vs textContent
Created:
one year 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!" + Math.random(); }
innerHtml
let i = 1000; let el = document.querySelector("#hello"); while (i--) { el.innerHtml = "Goodbye, cruel world!" + Math.random(); }
textContent
let i = 1000; let el = document.querySelector("#hello"); while (i--) { el.textContent = "Goodbye, cruel world!" + Math.random(); }
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:
5 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0
Browser/OS:
Firefox 145 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
innerText
188.8 Ops/sec
innerHtml
6273.6 Ops/sec
textContent
218.8 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 - innerText - textContent
innerHTML vs innerText vs textContent 3
innerHTML vs innerText vs textContent ..
innerHTML vs innerText vs textContent with lower i
Comments
Confirm delete:
Do you really want to delete benchmark?