Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Chrome 102
Windows
Desktop
2 years ago
Test name Executions per second
childNodes foreach 272330.1 Ops/sec
children (direct) 367262.8 Ops/sec
firstChild nextSibling 2150276.0 Ops/sec
firstElementChild nextElementChild 3597394.0 Ops/sec
ChildNodes for (into variable) 558580.8 Ops/sec
children-- (direct) 766210.1 Ops/sec
ChildNodes for-- (into variable) 252075.8 Ops/sec
ChildNodes for-- (direct) 615478.7 Ops/sec
lastElementChild previousElementChild 3569938.0 Ops/sec
children-- (into variable) 934976.6 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)