Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Chrome 125
Mac OS X 10.15.7
Desktop
6 months ago
Test name Executions per second
childNodes foreach 1633928.6 Ops/sec
children (direct) 2260185.0 Ops/sec
firstChild nextSibling 8553824.0 Ops/sec
firstElementChild nextElementChild 14094505.0 Ops/sec
ChildNodes for (into variable) 4238731.0 Ops/sec
children-- (direct) 3945966.5 Ops/sec
ChildNodes for-- (into variable) 2114473.0 Ops/sec
ChildNodes for-- (direct) 5132581.0 Ops/sec
lastElementChild previousElementChild 13945823.0 Ops/sec
children-- (into variable) 8548119.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)