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
appendChild w/ requestAnimationFrame
1.1M/s
append documentFragment w/ requestAnimationFrame
111K/s
appendChild
71K/s
append documentFragment
53K/s
View exact numbers
Test name
Executions per second
✓
appendChild w/ requestAnimationFrame
1,116,771 Ops/sec
append documentFragment w/ requestAnimationFrame
110,602 Ops/sec
appendChild
71,312 Ops/sec
append documentFragment
52,923 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) })