Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.62 Safari/537.36
Chrome 102
Windows
Desktop
2 years ago
Test name Executions per second
append() 109425.7 Ops/sec
appendChild() 119270.0 Ops/sec
append() with apply() 110479.8 Ops/sec
appendChild() with loop 106775.4 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]);