Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.31
Chrome 117
Windows
Desktop
one year ago
Test name Executions per second
childNodes foreach 629319.8 Ops/sec
children (direct) 849352.2 Ops/sec
children (into variable) 2385627.5 Ops/sec
children-- (direct) 1382130.1 Ops/sec
children-- (into variable) 3051974.8 Ops/sec
ChildNodes for (direct) 446341.5 Ops/sec
ChildNodes for (into variable) 1631156.8 Ops/sec
ChildNodes for-- (direct) 758549.2 Ops/sec
ChildNodes for-- (into variable) 2075338.9 Ops/sec
firstElementChild nextElementChild 5528009.0 Ops/sec
lastElementChild previousElementChild 5510178.5 Ops/sec
firstChild nextSibling 4411911.0 Ops/sec
lastChild previousSibling 4426229.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • childNodes foreach

  • children (direct)

  • children (into variable)

  • children-- (direct)

  • children-- (into variable)

  • ChildNodes for (direct)

  • ChildNodes for (into variable)

  • ChildNodes for-- (direct)

  • ChildNodes for-- (into variable)

  • firstElementChild nextElementChild

  • lastElementChild previousElementChild

  • firstChild nextSibling

  • lastChild previousSibling