Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0
Firefox 75
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 1833396.9 Ops/sec
jQuery (tag.id) 279771.1 Ops/sec
jQuery (tag#id) 246192.3 Ops/sec
jQuery (.id) 427280.2 Ops/sec
jQuery (#id) 2241563.5 Ops/sec
Cash + getElementsByClassName 746786.2 Ops/sec
Cash + getElementById 1390814.1 Ops/sec
Cash (tag.id) 544954.6 Ops/sec
jQuery + getElementById 1373045.4 Ops/sec
Cash (tag#id) 451712.5 Ops/sec
Cash (#id) 2736330.5 Ops/sec
querySelectorAll (.id) 665026.8 Ops/sec
querySelectorAll (#id) 648263.6 Ops/sec
querySelector (.id) 1476836.1 Ops/sec
querySelector (#id) 1626936.6 Ops/sec
getElementsByTagName 1581665.8 Ops/sec
getElementsByClassName 1231316.8 Ops/sec
Cash (.id) 925659.6 Ops/sec
jQuery + getElementsByClassName 435792.9 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