Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Safari/605.1.15
Safari 15
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
childNodes foreach 1510001.4 Ops/sec
children (direct) 822567.6 Ops/sec
firstChild nextSibling 5679458.0 Ops/sec
firstElementChild nextElementChild 5585004.0 Ops/sec
ChildNodes for (into variable) 2122231.0 Ops/sec
children-- (direct) 1355319.2 Ops/sec
ChildNodes for-- (into variable) 727522.9 Ops/sec
ChildNodes for-- (direct) 2465483.0 Ops/sec
lastElementChild previousElementChild 5604450.0 Ops/sec
children-- (into variable) 3550297.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)