Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36
Chrome 96
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
getElementById 7369898.0 Ops/sec
jQuery (tag.id) 1145021.8 Ops/sec
jQuery (tag#id) 1088385.8 Ops/sec
jQuery (.id) 1526490.1 Ops/sec
jQuery (#id) 4363869.5 Ops/sec
Cash + getElementsByClassName 2517064.0 Ops/sec
Cash + getElementById 3315956.2 Ops/sec
Cash (tag.id) 1486403.5 Ops/sec
jQuery + getElementById 3418190.8 Ops/sec
Cash (tag#id) 1301697.5 Ops/sec
Cash (#id) 4794651.5 Ops/sec
querySelectorAll (.id) 3286356.5 Ops/sec
querySelectorAll (#id) 2659452.2 Ops/sec
querySelector (.id) 7089816.0 Ops/sec
querySelector (#id) 4190455.8 Ops/sec
getElementsByTagName 6008089.5 Ops/sec
getElementsByClassName 5133518.0 Ops/sec
Cash (.id) 1812540.2 Ops/sec
jQuery + getElementsByClassName 1338732.6 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