Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36
Chrome 89
Mac OS X 11.2.3
Desktop
3 years ago
Test name Executions per second
getElementById 3314011.8 Ops/sec
jQuery (tag.id) 482542.4 Ops/sec
jQuery (tag#id) 454154.0 Ops/sec
jQuery (.id) 768780.5 Ops/sec
jQuery (#id) 1529023.8 Ops/sec
Cash + getElementsByClassName 835740.2 Ops/sec
Cash + getElementById 1185306.9 Ops/sec
Cash (tag.id) 810265.9 Ops/sec
jQuery + getElementById 1380670.2 Ops/sec
Cash (tag#id) 677814.4 Ops/sec
Cash (#id) 1757564.2 Ops/sec
querySelectorAll (.id) 1428632.2 Ops/sec
querySelectorAll (#id) 1020317.0 Ops/sec
querySelector (.id) 2718784.5 Ops/sec
querySelector (#id) 2041049.8 Ops/sec
getElementsByTagName 2807434.8 Ops/sec
getElementsByClassName 1731114.2 Ops/sec
Cash (.id) 973485.7 Ops/sec
jQuery + getElementsByClassName 490506.8 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