Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Whale/3.23.214.17 Safari/537.36
Chrome 118
Windows
Desktop
one year ago
Test name Executions per second
childNodes foreach 1712278.4 Ops/sec
children (direct) 2211427.5 Ops/sec
firstChild nextSibling 10849714.0 Ops/sec
firstElementChild nextElementChild 15387346.0 Ops/sec
ChildNodes for (into variable) 4567942.0 Ops/sec
children-- (direct) 3785519.0 Ops/sec
ChildNodes for-- (into variable) 1878857.0 Ops/sec
ChildNodes for-- (direct) 5590651.0 Ops/sec
lastElementChild previousElementChild 15225469.0 Ops/sec
children-- (into variable) 8694214.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)