Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Chrome 121
Windows
Desktop
10 months ago
Test name Executions per second
childNodes foreach 1341341.1 Ops/sec
children (direct) 1797327.8 Ops/sec
firstChild nextSibling 8946045.0 Ops/sec
firstElementChild nextElementChild 12925617.0 Ops/sec
ChildNodes for (into variable) 3845286.2 Ops/sec
children-- (direct) 2984691.5 Ops/sec
ChildNodes for-- (into variable) 1620655.2 Ops/sec
ChildNodes for-- (direct) 4185251.5 Ops/sec
lastElementChild previousElementChild 11244260.0 Ops/sec
children-- (into variable) 6310714.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)