Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54
Chrome 108
Windows
Desktop
one year ago
Test name Executions per second
childNodes foreach 1083792.8 Ops/sec
children (direct) 1607354.4 Ops/sec
children (into variable) 5319859.0 Ops/sec
children-- (direct) 2766141.5 Ops/sec
children-- (into variable) 6637277.0 Ops/sec
ChildNodes for (direct) 849569.4 Ops/sec
ChildNodes for (into variable) 3568481.2 Ops/sec
ChildNodes for-- (direct) 1465198.0 Ops/sec
ChildNodes for-- (into variable) 4452523.0 Ops/sec
firstElementChild nextElementChild 10342921.0 Ops/sec
lastElementChild previousElementChild 10279840.0 Ops/sec
firstChild nextSibling 7742277.0 Ops/sec
lastChild previousSibling 7698026.5 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