Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Chrome 129
Mac OS X 10.15.7
Desktop
2 months ago
Test name Executions per second
childNodes foreach 1870294.8 Ops/sec
children (direct) 2611374.2 Ops/sec
firstChild nextSibling 9245765.0 Ops/sec
firstElementChild nextElementChild 15010623.0 Ops/sec
ChildNodes for (into variable) 4653323.5 Ops/sec
children-- (direct) 4592751.5 Ops/sec
ChildNodes for-- (into variable) 2399889.0 Ops/sec
ChildNodes for-- (direct) 5971474.5 Ops/sec
lastElementChild previousElementChild 14791941.0 Ops/sec
children-- (into variable) 9820943.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)