Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Chrome 116
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
childNodes foreach 1760331.6 Ops/sec
children (direct) 2669821.0 Ops/sec
firstChild nextSibling 10417199.0 Ops/sec
firstElementChild nextElementChild 16786948.0 Ops/sec
ChildNodes for (into variable) 4828828.0 Ops/sec
children-- (direct) 4597048.5 Ops/sec
ChildNodes for-- (into variable) 2441556.0 Ops/sec
ChildNodes for-- (direct) 6154849.5 Ops/sec
lastElementChild previousElementChild 15958049.0 Ops/sec
children-- (into variable) 9735955.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)