Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Chrome 114
Windows
Desktop
one year ago
Test name Executions per second
childNodes foreach 675098.8 Ops/sec
children (direct) 1086015.6 Ops/sec
firstChild nextSibling 5109986.0 Ops/sec
firstElementChild nextElementChild 6226812.5 Ops/sec
ChildNodes for (into variable) 2161107.5 Ops/sec
children-- (direct) 1816040.9 Ops/sec
ChildNodes for-- (into variable) 956901.0 Ops/sec
ChildNodes for-- (direct) 2629537.2 Ops/sec
lastElementChild previousElementChild 6174332.0 Ops/sec
children-- (into variable) 4122837.0 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)