Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Chrome 110
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
childNodes foreach 1396165.5 Ops/sec
children (direct) 1898342.4 Ops/sec
firstChild nextSibling 7842759.5 Ops/sec
firstElementChild nextElementChild 11744376.0 Ops/sec
ChildNodes for (into variable) 3538177.0 Ops/sec
children-- (direct) 3251534.2 Ops/sec
ChildNodes for-- (into variable) 1691379.6 Ops/sec
ChildNodes for-- (direct) 4470473.0 Ops/sec
lastElementChild previousElementChild 11498877.0 Ops/sec
children-- (into variable) 7594796.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)