Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 OPR/101.0.0.0
Opera 101
Windows
Desktop
one year ago
Test name Executions per second
childNodes foreach 557158.1 Ops/sec
children (direct) 837449.6 Ops/sec
firstChild nextSibling 4797672.5 Ops/sec
firstElementChild nextElementChild 6513276.5 Ops/sec
ChildNodes for (into variable) 1737633.6 Ops/sec
children-- (direct) 1434431.0 Ops/sec
ChildNodes for-- (into variable) 769802.8 Ops/sec
ChildNodes for-- (direct) 2001824.9 Ops/sec
lastElementChild previousElementChild 5507640.5 Ops/sec
children-- (into variable) 2327882.8 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)