Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JS: append vs appendChild multiple elements with spread syntax
Comparing performance of: for (c of children) append(c) vs append(...c) vs for (c of children) appendChild(c)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
append with spread syntax
404665.3 Ops/sec
for ... append
376422.0 Ops/sec
for ... appendChild
511906.4 Ops/sec
HTML Preparation code:
<div id="container"></div>
Script Preparation code:
const container = document.getElementById("container"); const paragraphs = []; for (c of "abcdefg") { const p = document.createElement("p"); p.textContent = c; paragraphs.push(p); }
Tests:
append with spread syntax
container.append(...paragraphs);
for ... append
for (const p of paragraphs) { container.append(p); }
for ... appendChild
for (const p of paragraphs) { container.appendChild(p); }