Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Setting text content
(version: 0)
Comparing performance of:
textContent vs innerText vs replaceChildren, createTextNode and appendChild
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<div id='test'></div>
Script Preparation code:
function setText1(element, text) { element.textContent = text; } function setText2(element, text) { element.innerText = text; } function setText3(element, text) { element.replaceChildren(); element.appendChild(element.ownerDocument.createTextNode(text)); }
Tests:
textContent
setText1(test, ""); setText1(test, "<b>Hello</b>");
innerText
setText2(test, ""); setText2(test, "<b>Hello</b>");
replaceChildren, createTextNode and appendChild
setText3(test, ""); setText3(test, "<b>Hello</b>");
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
textContent
innerText
replaceChildren, createTextNode and appendChild
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!
Comments
Confirm delete:
Do you really want to delete benchmark?