Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0
Firefox 103
Ubuntu
Desktop
2 years ago
Test name Executions per second
childNodes foreach 2250990.2 Ops/sec
children (direct) 3062584.8 Ops/sec
firstChild nextSibling 4815883.5 Ops/sec
firstElementChild nextElementChild 18459958.0 Ops/sec
ChildNodes for (into variable) 2509785.2 Ops/sec
children-- (direct) 4936328.5 Ops/sec
ChildNodes for-- (into variable) 2489648.5 Ops/sec
ChildNodes for-- (direct) 3799929.0 Ops/sec
lastElementChild previousElementChild 16693041.0 Ops/sec
children-- (into variable) 7379273.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)