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 871099.4 Ops/sec
children (direct) 1518194.0 Ops/sec
firstChild nextSibling 6367343.0 Ops/sec
firstElementChild nextElementChild 9534095.0 Ops/sec
ChildNodes for (into variable) 2930945.0 Ops/sec
children-- (direct) 2523855.8 Ops/sec
ChildNodes for-- (into variable) 1266898.0 Ops/sec
ChildNodes for-- (direct) 3558728.8 Ops/sec
lastElementChild previousElementChild 9190231.0 Ops/sec
children-- (into variable) 5727088.5 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)