Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
textContent vs innerHTML vs innerText vs
(version: 1)
ff
Comparing performance of:
textc vs innerh vs innert
Created:
10 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<div id="container"></div>
Script Preparation code:
var node = document.getElementById('container'); for(var i = 0; i < 1000; i++) node.appendChild(document.createElement('div'));
Tests:
textc
var node = document.getElementById('container'); node.textContent = '';
innerh
var node = document.getElementById('container'); node.innerHTML = '';
innert
var node = document.getElementById('container'); node.innerText = '';
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
textc
innerh
innert
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Browser/OS:
Chrome 144 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
textc
20625794.0 Ops/sec
innerh
18946860.0 Ops/sec
innert
14305015.0 Ops/sec
Related benchmarks:
innerhtml vs removechild
innerhtml vs removechild
innerHTML && removeChild
textContent vs innerText
innerhtml vs removechild(firstChild) vs removechild(lastChild) vs innerText vs textContent
innerhtml vs innerText vs removechild vs remove!
textContent vs removechild
innerhtml vs removechild vs remove vs innerText vs textContent vs replaceChildren
innerhtml vs removechild vs remove vs innerText vs textContent vs replaceChildren (100)
Comments
Confirm delete:
Do you really want to delete benchmark?