Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
insertAdjacentHTML vs appendChild vs append vs insertAdjacentElement vs innerHTML repeat 1000
insertAdjacentHTML vs appendChild vs append vs insertAdjacentElement vs innerHTML
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0
Browser:
Firefox 138
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
insertAdjacentHTML
239.2 Ops/sec
appendChild
120.5 Ops/sec
append
102.6 Ops/sec
insertAdjacentElement
118.6 Ops/sec
innerHTML
300.8 Ops/sec
Script Preparation code:
// Change this number to see how well they scale repeat = 1000;
Tests:
insertAdjacentHTML
const box = document.createElement('div'); let html = ''; for (let i = 0; i < repeat; i++) html += '<div class="a b"><div>Test</div></div>'; box.insertAdjacentHTML('beforeend', html);
appendChild
const box = document.createElement('div'); const els = []; for (let i = 0; i < repeat; i++) { const div2 = document.createElement('div'); div2.innerText = 'Test'; const div1 = document.createElement('div'); div1.className = 'a b'; div1.appendChild(div2); els.push(div1); } els.forEach(el => box.appendChild(el));
append
const box = document.createElement('div'); const els = []; for (let i = 0; i < repeat; i++) { const div2 = document.createElement('div'); div2.innerText = 'Test'; const div1 = document.createElement('div'); div1.className = 'a b'; div1.append(div2); els.push(div1); } box.append(...els);
insertAdjacentElement
const box = document.createElement('div'); const els = []; for (let i = 0; i < repeat; i++) { const div2 = document.createElement('div'); div2.innerText = 'Test'; const div1 = document.createElement('div'); div1.className = 'a b'; div1.insertAdjacentElement('beforeend', div2); els.push(div1); } els.forEach(el => box.insertAdjacentElement('beforeend', el));
innerHTML
const box = document.createElement('div'); let html = ''; for (let i = 0; i < repeat; i++) html += '<div class="a b"><div>Test</div></div>'; box.innerHTML += html;