Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36
Chrome 118
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
childNodes foreach 826881.1 Ops/sec
children (direct) 1276467.1 Ops/sec
firstChild nextSibling 6357634.0 Ops/sec
firstElementChild nextElementChild 9232750.0 Ops/sec
ChildNodes for (into variable) 2046076.6 Ops/sec
children-- (direct) 2115908.2 Ops/sec
ChildNodes for-- (into variable) 1064085.6 Ops/sec
ChildNodes for-- (direct) 2297923.8 Ops/sec
lastElementChild previousElementChild 8307351.5 Ops/sec
children-- (into variable) 4175305.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)