Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
insertAdjacentHTML vs appendChild 2025
(version: 1)
Comparing performance of:
AppendChild vs insertAdjacentHTML
Created:
10 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<div id="test"></div>
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
AppendChild
const aboutDiv = document.createDocumentFragment(); const newElement = document.createElement("div"); newElement.id = "testing" for (i = 0; i < 1000; i++) { const newElementPart = document.createElement("div"); newElementPart.classList.add("testClass"); newElement.appendChild(newElementPart); } aboutDiv.appendChild(newElement); document.getElementById("test").appendChild(aboutDiv);
insertAdjacentHTML
html = "<div id='testing'>" for (i = 0; i < 1000; i++) { html += "<div class='testClass'></div>"; } html += "</div>"; document.getElementById("test").insertAdjacentHTML("beforeend", html);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
AppendChild
insertAdjacentHTML
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
10 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0
Browser/OS:
Firefox 141 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
AppendChild
388.3 Ops/sec
insertAdjacentHTML
911.0 Ops/sec
Related benchmarks:
className vs classList normalization
Splti vs Trim vs replace className
testingqueries
test early return
Query Element
set: innerHTML vs outerHTML
adding elements
createElement vs DOMParser
CleanVsDirty
Comments
Confirm delete:
Do you really want to delete benchmark?