Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
appendChild cycles vs documentFragment
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 133
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
appendChild
71311.7 Ops/sec
append documentFragment
52923.0 Ops/sec
appendChild w/ requestAnimationFrame
1116771.2 Ops/sec
append documentFragment w/ requestAnimationFrame
110601.8 Ops/sec
HTML Preparation code:
<div id="container"></div>
Script Preparation code:
var container = document.getElementById('container'); var childrenAmount = 20; var childrenToAppend = []; for(let i = 0; i < childrenAmount; i++) { childrenToAppend.push(document.createElement('div')) }
Tests:
appendChild
childrenToAppend.forEach(child => container.appendChild(child));
append documentFragment
var fragment = document.createDocumentFragment(); childrenToAppend.forEach(child => fragment.appendChild(child)); container.appendChild(fragment)
appendChild w/ requestAnimationFrame
requestAnimationFrame(() => { childrenToAppend.forEach(child => container.appendChild(child)); })
append documentFragment w/ requestAnimationFrame
var fragment = document.createDocumentFragment(); childrenToAppend.forEach(child => fragment.appendChild(child)); requestAnimationFrame(() => { container.appendChild(fragment) })