HTML Preparation code:
AخA
 
1
<div id='foo'></div>
Script Preparation code:
 
let parent = document.getElementById('foo');
    
for (let i = 0; i < 1000; i++) {
  let child = document.createElement('div');
  parent.appendChild(child);
}
Tests:
  • Loop

     
    const parent = document.getElementById("foo")
    while (parent.firstChild) {
        parent.firstChild.remove()
    }
  • innerHTML

     
    const parent = document.getElementById("foo")
    parent.innerHTML = "";
  • innerText

     
    const parent = document.getElementById("foo")
    parent.innerText = "";
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Loop
    innerHTML
    innerText

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36
Chrome 84 on Linux
View result in a separate tab
Test name Executions per second
Loop 3759548.2 Ops/sec
innerHTML 2594207.2 Ops/sec
innerText 2562128.5 Ops/sec