Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.41
Chrome 117
Windows
Desktop
one year ago
Test name Executions per second
childNodes foreach 812721.1 Ops/sec
children (direct) 1185671.2 Ops/sec
firstChild nextSibling 6220208.5 Ops/sec
firstElementChild nextElementChild 7620267.0 Ops/sec
ChildNodes for (into variable) 2485073.0 Ops/sec
children-- (direct) 2008751.8 Ops/sec
ChildNodes for-- (into variable) 1075628.9 Ops/sec
ChildNodes for-- (direct) 3119842.5 Ops/sec
lastElementChild previousElementChild 8010675.5 Ops/sec
children-- (into variable) 4498702.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)