Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0
Firefox 85
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 4257172.5 Ops/sec
jQuery (tag.id) 503474.7 Ops/sec
jQuery (tag#id) 515775.4 Ops/sec
jQuery (.id) 820799.4 Ops/sec
jQuery (#id) 4107216.8 Ops/sec
Cash + getElementsByClassName 1366866.1 Ops/sec
Cash + getElementById 2665530.5 Ops/sec
Cash (tag.id) 789130.6 Ops/sec
jQuery + getElementById 2719318.2 Ops/sec
Cash (tag#id) 753479.0 Ops/sec
Cash (#id) 4143846.5 Ops/sec
querySelectorAll (.id) 1065438.6 Ops/sec
querySelectorAll (#id) 979850.9 Ops/sec
querySelector (.id) 2335088.5 Ops/sec
querySelector (#id) 2861162.5 Ops/sec
getElementsByTagName 3170043.5 Ops/sec
getElementsByClassName 1947991.5 Ops/sec
Cash (.id) 1352989.1 Ops/sec
jQuery + getElementsByClassName 627297.0 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