Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Chrome 124
Mac OS X 10.15.7
Desktop
5 months ago
Test name Executions per second
childNodes foreach 1563090.8 Ops/sec
children (direct) 1943584.5 Ops/sec
firstChild nextSibling 7738302.0 Ops/sec
firstElementChild nextElementChild 11664792.0 Ops/sec
ChildNodes for (into variable) 3549311.8 Ops/sec
children-- (direct) 3313232.5 Ops/sec
ChildNodes for-- (into variable) 1715581.1 Ops/sec
ChildNodes for-- (direct) 4504021.5 Ops/sec
lastElementChild previousElementChild 11764229.0 Ops/sec
children-- (into variable) 7465092.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)