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 Edg/125.0.0.0
Chrome 125
Windows
Desktop
7 months ago
Test name Executions per second
childNodes foreach 928657.4 Ops/sec
children (direct) 1204330.4 Ops/sec
firstChild nextSibling 6221367.5 Ops/sec
firstElementChild nextElementChild 7854200.0 Ops/sec
ChildNodes for (into variable) 2693815.8 Ops/sec
children-- (direct) 1977056.2 Ops/sec
ChildNodes for-- (into variable) 1155334.8 Ops/sec
ChildNodes for-- (direct) 3268049.0 Ops/sec
lastElementChild previousElementChild 7655607.0 Ops/sec
children-- (into variable) 4554184.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)