Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Chrome 123
Windows
Desktop
8 months ago
Test name Executions per second
childNodes foreach 293004.7 Ops/sec
children (direct) 561819.8 Ops/sec
firstChild nextSibling 3006007.2 Ops/sec
firstElementChild nextElementChild 4277112.0 Ops/sec
ChildNodes for (into variable) 1215744.8 Ops/sec
children-- (direct) 732870.1 Ops/sec
ChildNodes for-- (into variable) 601568.9 Ops/sec
ChildNodes for-- (direct) 1425922.9 Ops/sec
lastElementChild previousElementChild 4218637.5 Ops/sec
children-- (into variable) 2351630.2 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)