Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0
Firefox 88
Windows
Desktop
3 years ago
Test name Executions per second
innerHTML 142.4 Ops/sec
insertAdjacentHTML 233102.9 Ops/sec
Script Preparation code:
x
 
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( 'beforeend', `
        <div>
            <span>Child 4</span>
        </div>
    ` );