Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0
Firefox 104
Windows
Desktop
2 years ago
Test name Executions per second
getElementById 2347425.5 Ops/sec
jQuery (tag.id) 405639.5 Ops/sec
jQuery (tag#id) 304937.0 Ops/sec
jQuery (.id) 639524.1 Ops/sec
jQuery (#id) 2158613.2 Ops/sec
Cash + getElementsByClassName 688645.5 Ops/sec
Cash + getElementById 1334413.0 Ops/sec
Cash (tag.id) 627769.6 Ops/sec
jQuery + getElementById 1423595.9 Ops/sec
Cash (tag#id) 478860.0 Ops/sec
Cash (#id) 2915430.8 Ops/sec
querySelectorAll (.id) 558595.4 Ops/sec
querySelectorAll (#id) 496565.6 Ops/sec
querySelector (.id) 1483306.0 Ops/sec
querySelector (#id) 1270775.1 Ops/sec
getElementsByTagName 1434849.8 Ops/sec
getElementsByClassName 1102752.5 Ops/sec
Cash (.id) 1008573.7 Ops/sec
jQuery + getElementsByClassName 346537.3 Ops/sec
HTML Preparation code:
Tests:
  • getElementById

  • getElementsByClassName

  • getElementsByTagName

  • querySelector (#id)

  • querySelector (.id)

  • querySelectorAll (#id)

  • querySelectorAll (.id)

  • Cash (#id)

  • Cash (.id)

  • Cash (tag#id)

  • Cash (tag.id)

  • Cash + getElementById

  • Cash + getElementsByClassName

  • jQuery (#id)

  • jQuery (.id)

  • jQuery (tag#id)

  • jQuery (tag.id)

  • jQuery + getElementById

  • jQuery + getElementsByClassName


;