Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JS: append vs appendChild multiple nodes
(version: 0)
Comparing performance of:
append vs appendChild vs document.fragment
Created:
3 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<div id="container"></div>
Script Preparation code:
var paragraphs = Array.from({length: 1000}, () => document.createElement("p")); var container = document.getElementById("container");
Tests:
append
container.append(...paragraphs);
appendChild
for (let i = 0; i < paragraphs.length; i++) { container.appendChild(paragraphs[i]); }
document.fragment
const fragment = new DocumentFragment(); for (let i = 0; i < paragraphs.length; i++) { fragment.append(paragraphs[i]); } container.append(fragment);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
append
appendChild
document.fragment
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 Edg/135.0.0.0
Browser/OS:
Chrome 135 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
append
2683.0 Ops/sec
appendChild
3057.2 Ops/sec
document.fragment
1627.6 Ops/sec
Related benchmarks:
JS: append vs appendChild
ParentNode.append() vs Node.appendChild() for adding a couple elements
JS: append vs appendChild multiple elements
JS: append vs appendChild for multiple children
Comments
Confirm delete:
Do you really want to delete benchmark?