Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36
Chrome 95
Linux
Desktop
3 years ago
Test name Executions per second
childNodes foreach 628326.2 Ops/sec
children (direct) 988799.8 Ops/sec
firstChild nextSibling 6865734.0 Ops/sec
firstElementChild nextElementChild 9084519.0 Ops/sec
ChildNodes for (into variable) 1789789.6 Ops/sec
children-- (direct) 1555491.1 Ops/sec
ChildNodes for-- (into variable) 823311.1 Ops/sec
ChildNodes for-- (direct) 2301087.5 Ops/sec
lastElementChild previousElementChild 9144582.0 Ops/sec
children-- (into variable) 3423843.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)