Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Reading textContent vs innerText vs innerHTML
(version: 1)
Comparing performance of:
textContent vs innerText vs innerHTML
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:
textContent
let i = 1000, tmp = ''; while (i--) tmp = el.textContent;
innerText
let i = 1000, tmp = ''; while (i--) tmp = el.innerText;
innerHTML
let i = 1000, tmp = ''; while (i--) tmp = el.innerHTML;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
textContent
innerText
innerHTML
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
3 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0
Browser/OS:
Firefox 147 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
textContent
1394835.8 Ops/sec
innerText
2987.8 Ops/sec
innerHTML
1188129.1 Ops/sec
Related benchmarks:
innerText vs textContent vs innerHTML
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 ..
innerHTML vs innerText vs textContent with lower i
Comments
Confirm delete:
Do you really want to delete benchmark?