Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Chrome 83
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2085442.9 Ops/sec
jQuery (tag.id) 217533.2 Ops/sec
jQuery (tag#id) 203601.8 Ops/sec
jQuery (.id) 297642.3 Ops/sec
jQuery (#id) 1175041.6 Ops/sec
Cash + getElementsByClassName 651461.2 Ops/sec
Cash + getElementById 687673.3 Ops/sec
Cash (tag.id) 218669.8 Ops/sec
jQuery + getElementById 730472.8 Ops/sec
Cash (tag#id) 245898.7 Ops/sec
Cash (#id) 1315969.6 Ops/sec
querySelectorAll (.id) 819477.5 Ops/sec
querySelectorAll (#id) 642286.4 Ops/sec
querySelector (.id) 2208873.5 Ops/sec
querySelector (#id) 1342520.5 Ops/sec
getElementsByTagName 1723521.1 Ops/sec
getElementsByClassName 1428948.4 Ops/sec
Cash (.id) 362194.5 Ops/sec
jQuery + getElementsByClassName 310722.5 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