Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.2 Safari/605.1.15
Safari 16
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
childNodes foreach 2568793.0 Ops/sec
children (direct) 1363162.2 Ops/sec
firstChild nextSibling 8813491.0 Ops/sec
firstElementChild nextElementChild 8986872.0 Ops/sec
ChildNodes for (into variable) 3211297.8 Ops/sec
children-- (direct) 2253745.8 Ops/sec
ChildNodes for-- (into variable) 1218930.9 Ops/sec
ChildNodes for-- (direct) 3940362.5 Ops/sec
lastElementChild previousElementChild 8985450.0 Ops/sec
children-- (into variable) 5862246.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)