Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Chrome 106
Windows
Desktop
2 years ago
Test name Executions per second
getElementById 2783554.5 Ops/sec
jQuery (tag.id) 472343.5 Ops/sec
jQuery (tag#id) 450983.0 Ops/sec
jQuery (.id) 624041.2 Ops/sec
jQuery (#id) 1429384.9 Ops/sec
Cash + getElementsByClassName 809302.3 Ops/sec
Cash + getElementById 1090626.2 Ops/sec
Cash (tag.id) 695973.1 Ops/sec
jQuery + getElementById 1148607.0 Ops/sec
Cash (tag#id) 598168.1 Ops/sec
Cash (#id) 1560881.4 Ops/sec
querySelectorAll (.id) 1407849.1 Ops/sec
querySelectorAll (#id) 1048071.0 Ops/sec
querySelector (.id) 2484551.0 Ops/sec
querySelector (#id) 1626394.2 Ops/sec
getElementsByTagName 2357761.8 Ops/sec
getElementsByClassName 1960564.6 Ops/sec
Cash (.id) 810808.4 Ops/sec
jQuery + getElementsByClassName 524910.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