Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Chrome 126
Windows
Desktop
7 months ago
Test name Executions per second
childNodes foreach 161494.7 Ops/sec
children (direct) 295988.7 Ops/sec
firstChild nextSibling 1465045.4 Ops/sec
firstElementChild nextElementChild 2015169.4 Ops/sec
ChildNodes for (into variable) 521040.0 Ops/sec
children-- (direct) 462176.8 Ops/sec
ChildNodes for-- (into variable) 230027.9 Ops/sec
ChildNodes for-- (direct) 551425.6 Ops/sec
lastElementChild previousElementChild 2015412.0 Ops/sec
children-- (into variable) 980400.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)