Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Chrome 125
Windows
Desktop
7 months ago
Test name Executions per second
childNodes foreach 660982.0 Ops/sec
children (direct) 893028.7 Ops/sec
firstChild nextSibling 4324839.0 Ops/sec
firstElementChild nextElementChild 6169075.5 Ops/sec
ChildNodes for (into variable) 1736133.9 Ops/sec
children-- (direct) 1486045.1 Ops/sec
ChildNodes for-- (into variable) 768467.2 Ops/sec
ChildNodes for-- (direct) 2007434.0 Ops/sec
lastElementChild previousElementChild 6109103.5 Ops/sec
children-- (into variable) 3483913.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)