Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
innerHTML vs insertAdjacentHTML vs appendChild vs append vs insertAdjacentElement
innerHTML vs insertAdjacentHTML vs appendChild vs append vs insertAdjacentElement
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:126.0) Gecko/20100101 Firefox/126.0
Browser:
Firefox 126
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
innerHTML
53198.5 Ops/sec
insertAdjacentHTML
51256.8 Ops/sec
appendChild
28230.0 Ops/sec
append
36545.3 Ops/sec
insertAdjacentElement
34097.9 Ops/sec
Script Preparation code:
// Change this number to see how well they scale repeat = 10;
Tests:
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;
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));