Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
append multiple vs appendChild documentFragment (2)
(version: 4)
Comparing performance of:
append multiple vs appendChild documentFragment
Created:
2 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<ul id="test1"></ul> <ul id="test2"></ul>
Tests:
append multiple
const userList = [{ name: "john" }, { name: "jason" }, { name: "milli" }]; const ul = document.querySelector("#test1"); const userTagList = []; for (const { name } of userList) { const li = document.createElement("li"); li.textContent = name; userTagList.push(li); } ul.append(...userTagList);
appendChild documentFragment
const userList = [{ name: "john" }, { name: "jason" }, { name: "milli" }]; const ul = document.querySelector("#test2"); const fragment = document.createDocumentFragment(); for (const { name } of userList) { const li = document.createElement("li"); li.textContent = name; fragment.appendChild(li); } ul.appendChild(fragment);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
append multiple
appendChild documentFragment
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?