Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
Firefox 74
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3255776.0 Ops/sec
jQuery (tag.id) 474155.9 Ops/sec
jQuery (tag#id) 429310.8 Ops/sec
jQuery (.id) 776180.5 Ops/sec
jQuery (#id) 3680604.0 Ops/sec
Cash + getElementsByClassName 1385282.4 Ops/sec
Cash + getElementById 2249854.8 Ops/sec
Cash (tag.id) 873459.6 Ops/sec
jQuery + getElementById 2264513.2 Ops/sec
Cash (tag#id) 666434.7 Ops/sec
Cash (#id) 3847133.8 Ops/sec
querySelectorAll (.id) 1020477.8 Ops/sec
querySelectorAll (#id) 923716.1 Ops/sec
querySelector (.id) 2610084.0 Ops/sec
querySelector (#id) 2518070.0 Ops/sec
getElementsByTagName 2730532.8 Ops/sec
getElementsByClassName 2146671.0 Ops/sec
Cash (.id) 1407731.5 Ops/sec
jQuery + getElementsByClassName 712579.4 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