Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120
Windows
Desktop
11 months ago
Test name Executions per second
childNodes foreach 872954.7 Ops/sec
children (direct) 1220928.1 Ops/sec
firstChild nextSibling 5949429.0 Ops/sec
firstElementChild nextElementChild 8015731.0 Ops/sec
ChildNodes for (into variable) 2330475.8 Ops/sec
children-- (direct) 1851250.0 Ops/sec
ChildNodes for-- (into variable) 1005020.4 Ops/sec
ChildNodes for-- (direct) 2717028.5 Ops/sec
lastElementChild previousElementChild 7217141.5 Ops/sec
children-- (into variable) 3708413.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)