Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Chrome 122
Mac OS X 10.15.7
Desktop
9 months ago
Test name Executions per second
childNodes foreach 1630378.9 Ops/sec
children (direct) 2010564.9 Ops/sec
firstChild nextSibling 7893853.5 Ops/sec
firstElementChild nextElementChild 11909714.0 Ops/sec
ChildNodes for (into variable) 3656022.5 Ops/sec
children-- (direct) 3421156.8 Ops/sec
ChildNodes for-- (into variable) 1800601.1 Ops/sec
ChildNodes for-- (direct) 4986358.0 Ops/sec
lastElementChild previousElementChild 11920185.0 Ops/sec
children-- (into variable) 7733808.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)