Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Chrome 119
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
childNodes foreach 818729.9 Ops/sec
children (direct) 1264233.0 Ops/sec
firstChild nextSibling 6111666.5 Ops/sec
firstElementChild nextElementChild 8609732.0 Ops/sec
ChildNodes for (into variable) 2104236.5 Ops/sec
children-- (direct) 1946505.8 Ops/sec
ChildNodes for-- (into variable) 1104102.0 Ops/sec
ChildNodes for-- (direct) 2499954.8 Ops/sec
lastElementChild previousElementChild 5968421.0 Ops/sec
children-- (into variable) 3695274.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)