Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36
Chrome 95
Linux
Desktop
3 years ago
Test name Executions per second
childNodes foreach 613017.5 Ops/sec
children (direct) 982759.4 Ops/sec
children (into variable) 2547291.8 Ops/sec
children-- (direct) 1533439.4 Ops/sec
children-- (into variable) 3417670.2 Ops/sec
ChildNodes for (direct) 527120.9 Ops/sec
ChildNodes for (into variable) 1795710.9 Ops/sec
ChildNodes for-- (direct) 822558.8 Ops/sec
ChildNodes for-- (into variable) 2287524.2 Ops/sec
firstElementChild nextElementChild 9137618.0 Ops/sec
lastElementChild previousElementChild 9071572.0 Ops/sec
firstChild nextSibling 6856389.0 Ops/sec
lastChild previousSibling 6628145.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • childNodes foreach

  • children (direct)

  • children (into variable)

  • children-- (direct)

  • children-- (into variable)

  • ChildNodes for (direct)

  • ChildNodes for (into variable)

  • ChildNodes for-- (direct)

  • ChildNodes for-- (into variable)

  • firstElementChild nextElementChild

  • lastElementChild previousElementChild

  • firstChild nextSibling

  • lastChild previousSibling