Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Chrome 122
Mac OS X 10.15.7
Desktop
8 months ago
Test name Executions per second
childNodes foreach 887871.8 Ops/sec
children (direct) 1328155.5 Ops/sec
firstChild nextSibling 6272097.0 Ops/sec
firstElementChild nextElementChild 8817856.0 Ops/sec
ChildNodes for (into variable) 2230130.0 Ops/sec
children-- (direct) 2199788.2 Ops/sec
ChildNodes for-- (into variable) 1147618.2 Ops/sec
ChildNodes for-- (direct) 2984077.0 Ops/sec
lastElementChild previousElementChild 8474506.0 Ops/sec
children-- (into variable) 4664648.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)