Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
Chrome 107
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
childNodes foreach 796846.9 Ops/sec
children (direct) 1325633.8 Ops/sec
firstChild nextSibling 5951854.5 Ops/sec
firstElementChild nextElementChild 8340739.0 Ops/sec
ChildNodes for (into variable) 2398657.5 Ops/sec
children-- (direct) 2170754.2 Ops/sec
ChildNodes for-- (into variable) 1116459.6 Ops/sec
ChildNodes for-- (direct) 2848239.5 Ops/sec
lastElementChild previousElementChild 8192727.0 Ops/sec
children-- (into variable) 4938418.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • childNodes foreach

  • children (direct)

  • firstChild nextSibling

  • firstElementChild nextElementChild

  • ChildNodes for (into variable)

  • children-- (direct)

  • ChildNodes for-- (into variable)

  • ChildNodes for-- (direct)

  • lastElementChild previousElementChild

  • children-- (into variable)