Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Chrome 116
Windows
Desktop
one year ago
Test name Executions per second
childNodes foreach 675507.3 Ops/sec
children (direct) 986243.2 Ops/sec
firstChild nextSibling 5903893.5 Ops/sec
firstElementChild nextElementChild 7151936.0 Ops/sec
ChildNodes for (into variable) 2404100.8 Ops/sec
children-- (direct) 1666683.0 Ops/sec
ChildNodes for-- (into variable) 972094.4 Ops/sec
ChildNodes for-- (direct) 2828425.2 Ops/sec
lastElementChild previousElementChild 7110761.5 Ops/sec
children-- (into variable) 3702589.2 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)