Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.56
Chrome 107
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
childNodes foreach 1112293.6 Ops/sec
children (direct) 1475451.5 Ops/sec
firstChild nextSibling 6399040.5 Ops/sec
firstElementChild nextElementChild 10641117.0 Ops/sec
ChildNodes for (into variable) 2665692.0 Ops/sec
children-- (direct) 2422037.2 Ops/sec
ChildNodes for-- (into variable) 1252496.1 Ops/sec
ChildNodes for-- (direct) 3089473.5 Ops/sec
lastElementChild previousElementChild 9092505.0 Ops/sec
children-- (into variable) 5421596.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)