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:
  • using range

     
    const range = new Range();
    const frag = range.createContextualFragment("<h1>Some header</h1>")
    document.getElementById("target").appendChild(frag);
  • using insertAdjacentHTML

     
    document.getElementById("target").insertAdjacentHTML("afterbegin", "<h1>Some content</h1>")
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    using range
    using insertAdjacentHTML

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 7 months ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Chrome 125 on Linux
View result in a separate tab
Test name Executions per second
using range 6769.2 Ops/sec
using insertAdjacentHTML 6662.4 Ops/sec