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 Edg/129.0.0.0
Chrome 129
Windows
Desktop
2 months ago
Test name Executions per second
childNodes foreach 1035216.6 Ops/sec
children (direct) 1068929.8 Ops/sec
firstChild nextSibling 6688359.0 Ops/sec
firstElementChild nextElementChild 9020102.0 Ops/sec
ChildNodes for (into variable) 3171245.5 Ops/sec
children-- (direct) 2407328.5 Ops/sec
ChildNodes for-- (into variable) 1313356.8 Ops/sec
ChildNodes for-- (direct) 4053636.5 Ops/sec
lastElementChild previousElementChild 9491272.0 Ops/sec
children-- (into variable) 5789972.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)