Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
innerhtml vs removechild(firstChild) vs removechild(lastChild) vs innerText vs textContent
(version: 0)
Comparing performance of:
innerHTML vs removeChild vs removeChild backwards vs innerText vs textContent
Created:
5 years 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:
innerHTML
var node = document.getElementById('container'); node.innerHTML = '';
removeChild
var node = document.getElementById('container'); while(node.firstChild) node.removeChild(node.firstChild)
removeChild backwards
var node = document.getElementById('container'); while(node.lastChild) node.removeChild(node.lastChild)
innerText
var node = document.getElementById('container'); node.innerText = '';
textContent
var node = document.getElementById('container'); node.textContent = '';
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
innerHTML
removeChild
removeChild backwards
innerText
textContent
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
innerhtml vs removechild vs remove! (few child nodes)
innerhtml vs removechild vs remove vs innerText vs textContent
innerhtml vs removeChild-firstChild vs removeChild-lastChild
innerhtml vs innerText vs removechild vs remove!
innerhtml vs removechild(firstChild) vs removechild(lastChild) vs innerText vs replaceChildren()
Comments
Confirm delete:
Do you really want to delete benchmark?