Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
innerHTML vs insertAdjacentHTML vs appendChild vs insertAdjacentElement add attribute x100 fix
innerHTML vs insertAdjacentHTML vs appendChild vs insertAdjacentElement add attribute
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 Edg/137.0.0.0
Browser:
Chrome 137
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
appendChild
5K/s
insertAdjacentHTML
4K/s
insertAdjacentElement
4K/s
innerHTML
3/s
View exact numbers
Test name
Executions per second
✓
appendChild
5,420 Ops/sec
insertAdjacentHTML
4,420 Ops/sec
insertAdjacentElement
4,039 Ops/sec
innerHTML
3 Ops/sec
Script Preparation code:
box1 = document.createElement("div"); box2 = document.createElement("div"); box2.src = "https://google.com"; box2.setAttribute('style', 'position:absolute;display:block;width:300px;hright:300px;border:2px solid blue'); box2.textContent = "X";
Tests:
innerHTML
for (var i=0; i<100;i++){ box1.innerHTML += box2.outerHTML; }
insertAdjacentHTML
for (var i=0; i<100;i++){ box1.insertAdjacentHTML('beforeend', box2.outerHTML); }
appendChild
for (var i=0; i<100;i++){ let El = document.createElement("div"); El.src="https://google.com"; El.setAttribute('style','position:absolute;display:block;width:300px;hright:300px;border:2px solid blue'); El.textContent = "X"; box1.appendChild(El); }
insertAdjacentElement
for (var i=0; i<100;i++){ let El = document.createElement("div"); El.src = "https://google.com"; El.setAttribute('style', 'position:absolute;display:block;width:300px;hright:300px;border:2px solid blue'); El.textContent = "X"; box1.insertAdjacentElement('beforeend', El); }