Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0
Firefox 80
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3852898.8 Ops/sec
jQuery (tag.id) 515242.7 Ops/sec
jQuery (tag#id) 499955.6 Ops/sec
jQuery (.id) 873753.4 Ops/sec
jQuery (#id) 4898262.0 Ops/sec
Cash + getElementsByClassName 1523488.0 Ops/sec
Cash + getElementById 2699923.5 Ops/sec
Cash (tag.id) 997055.9 Ops/sec
jQuery + getElementById 2794905.5 Ops/sec
Cash (tag#id) 921772.0 Ops/sec
Cash (#id) 5819510.5 Ops/sec
querySelectorAll (.id) 1180327.1 Ops/sec
querySelectorAll (#id) 1034758.4 Ops/sec
querySelector (.id) 3125554.2 Ops/sec
querySelector (#id) 3059431.8 Ops/sec
getElementsByTagName 3025553.2 Ops/sec
getElementsByClassName 2344467.2 Ops/sec
Cash (.id) 1898200.1 Ops/sec
jQuery + getElementsByClassName 871345.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