Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
insertAdjacentHtml vs innerHTML - Replace
(version: 0)
insertAdjacentHtml vs innerHTML
Comparing performance of:
innerHTML vs insertAdjacentHTML
Created:
5 years ago
by:
Guest
Go to the latest result
Script Preparation code:
const targetElem = document.createElement( 'DIV' ); targetElem.id = 'target'; targetElem.innerHTML = ` <div> <span>Child 1</span> </div> <div> <span>Child 2</span> </div> <div> <span>Child 3</span> </div> `; document.body.appendChild( targetElem );
Tests:
innerHTML
document.getElementById( 'target' ).innerHTML = ` <div> <span>Child 4</span> </div> `;
insertAdjacentHTML
document.getElementById( 'target' ).insertAdjacentHTML( 'afterend', ` <div> <span>Child 4</span> </div> ` );
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
innerHTML
insertAdjacentHTML
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0
Browser/OS:
Chrome 136 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
insertAdjacentHTML
871K/s
innerHTML
594K/s
View exact numbers
Test name
Executions per second
✓
insertAdjacentHTML
871,429 Ops/sec
innerHTML
594,353 Ops/sec
Related benchmarks
insertAdjacentHtml vs innerHTML (multiple)
insertAdjacentHtml with remove vs innerHTML
insertAdjacentHtml vs createContextualFragment
insertAdjacentHtml vs innerHTML (no initial contents)
Comments
Confirm delete:
Do you really want to delete benchmark?