Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Chrome 122
Mac OS X 10.15.7
Desktop
9 months ago
Test name Executions per second
childNodes foreach 1652042.1 Ops/sec
children (direct) 2027794.8 Ops/sec
firstChild nextSibling 7930568.5 Ops/sec
firstElementChild nextElementChild 12091137.0 Ops/sec
ChildNodes for (into variable) 3730449.5 Ops/sec
children-- (direct) 3470957.5 Ops/sec
ChildNodes for-- (into variable) 1845004.6 Ops/sec
ChildNodes for-- (direct) 5035169.0 Ops/sec
lastElementChild previousElementChild 12141695.0 Ops/sec
children-- (into variable) 7771757.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)