Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Chrome 109
Windows
Desktop
one year ago
Test name Executions per second
childNodes foreach 381476.8 Ops/sec
children (direct) 591678.8 Ops/sec
firstChild nextSibling 3382922.5 Ops/sec
firstElementChild nextElementChild 4555505.0 Ops/sec
ChildNodes for (into variable) 1161881.9 Ops/sec
children-- (direct) 1090266.0 Ops/sec
ChildNodes for-- (into variable) 556203.9 Ops/sec
ChildNodes for-- (direct) 1382114.0 Ops/sec
lastElementChild previousElementChild 4750783.0 Ops/sec
children-- (into variable) 2359707.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)