Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
childNodes foreach 1795480.6 Ops/sec
children (direct) 2527178.8 Ops/sec
firstChild nextSibling 10331204.0 Ops/sec
firstElementChild nextElementChild 16727051.0 Ops/sec
ChildNodes for (into variable) 4801410.5 Ops/sec
children-- (direct) 4396168.0 Ops/sec
ChildNodes for-- (into variable) 2421866.0 Ops/sec
ChildNodes for-- (direct) 5943736.0 Ops/sec
lastElementChild previousElementChild 16200000.0 Ops/sec
children-- (into variable) 9354160.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)