Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0
Firefox 127
Windows
Desktop
6 months ago
Test name Executions per second
insertBefore 16289.7 Ops/sec
appendChild 18201.0 Ops/sec
prepend 14805.8 Ops/sec
insertAdjacentElement 16054.7 Ops/sec
HTML Preparation code:
AخA
 
1
<div id="container"></div>
Script Preparation code:
 
var container = document.getElementById("container");
var paragraph = document.createElement("p");
Tests:
  • insertBefore

     
    container.insertBefore(paragraph, null);
  • appendChild

     
    container.appendChild(paragraph);
  • prepend

     
    container.prepend(paragraph);
  • insertAdjacentElement

     
    container.insertAdjacentElement('afterbegin', paragraph);