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 |
<div id="container"></div>
var container = document.getElementById("container");
var paragraph = document.createElement("p");
container.insertBefore(paragraph, null);
container.appendChild(paragraph);
container.prepend(paragraph);
container.insertAdjacentElement('afterbegin', paragraph);