Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Chrome 129
Windows
Desktop
5 months ago
Test name Executions per second
append() 531419.8 Ops/sec
appendChild() 565911.6 Ops/sec
append() with apply() 524588.2 Ops/sec
appendChild() with loop 483389.5 Ops/sec
Script Preparation code:
AخA
 
var e1 = document.createElement('div');
var e2 = document.createElement('div');
var e3 = document.createElement('div');
var e4 = document.createElement('div');
var es = [e1, e2, e3, e4];
Tests:
  • append()

     
    document.body.append(e1, e2, e3, e4);
  • appendChild()

     
    document.body.appendChild(e1);
    document.body.appendChild(e2);
    document.body.appendChild(e3);
    document.body.appendChild(e4);
  • append() with apply()

     
    document.body.append.apply(document.body, es);
  • appendChild() with loop

     
    for (var i = 0; i < es.length; i++) document.body.appendChild(es[i]);