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; rv:136.0) Gecko/20100101 Firefox/136.0
Browser:
Firefox 136
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
append with spread syntax
300712.5 Ops/sec
for ... append
352486.0 Ops/sec
for ... appendChild
387781.5 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); }