Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Performance when getting innerHTML vs innerText vs textContent
(version: 1)
Comparing performance of:
innerText vs innerHtml vs textContent
Created:
8 months ago
by:
Registered User
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"); 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; }
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 (Macintosh; Intel Mac OS X 10.15; rv:147.0) Gecko/20100101 Firefox/147.0
Browser/OS:
Firefox 147 on Mac OS X 10.15
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
innerText
247.0 Ops/sec
innerHtml
2110326.2 Ops/sec
textContent
8762.2 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 ..
Reading textContent vs innerText vs innerHTML
Comments
Confirm delete:
Do you really want to delete benchmark?