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 1546123.5 Ops/sec
children (direct) 2046272.4 Ops/sec
firstChild nextSibling 8644958.0 Ops/sec
firstElementChild nextElementChild 12915284.0 Ops/sec
ChildNodes for (into variable) 3928791.2 Ops/sec
children-- (direct) 3509230.8 Ops/sec
ChildNodes for-- (into variable) 1852581.6 Ops/sec
ChildNodes for-- (direct) 5200890.5 Ops/sec
lastElementChild previousElementChild 12797145.0 Ops/sec
children-- (into variable) 8015246.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)