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:
4 years ago
by:
Guest
Jump 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:
11 months 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
Test name
Executions per second
innerHTML
594353.2 Ops/sec
insertAdjacentHTML
871428.6 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?