Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
appendChild vs append vs map/append vs DocumentFragment
(version: 0)
Comparing performance of:
appendChild vs append vs map/append vs DocumentFragment
Created:
3 years ago
by:
Guest
Jump to the latest result
Tests:
appendChild
const ul = document.createElement('ul'); for (const d of '123456') { const li = document.createElement('li'); li.textContent = d; ul.appendChild(li); }
append
const ul = document.createElement('ul'); for (const d of '123456') { const li = document.createElement('li'); li.textContent = d; ul.append(li); }
map/append
const ul = document.createElement('ul'); const lis = Array.from('123456').map((d) => { const li = document.createElement('li'); li.textContent = d; return li; }); ul.append(...lis);
DocumentFragment
const ul = document.createElement('ul'); const fragment = new DocumentFragment(); for (const d of '123456') { const li = document.createElement('li'); li.textContent = d; fragment.append(li); } ul.append(fragment);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
appendChild
append
map/append
DocumentFragment
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 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
374823.9 Ops/sec
append
206727.2 Ops/sec
map/append
321802.9 Ops/sec
DocumentFragment
284859.0 Ops/sec
Related benchmarks:
createTextNode vs textContent vs innerText vs append
ParentNode.append() vs Node.appendChild() for adding a couple elements
append() vs appendChild() for moving a couple elements
Single append vs multiple appendChild for large number of nodes
appendChild vs append
Comments
Confirm delete:
Do you really want to delete benchmark?