Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36
Chrome 81
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2540504.0 Ops/sec
jQuery (tag.id) 352652.4 Ops/sec
jQuery (tag#id) 336129.2 Ops/sec
jQuery (.id) 437538.4 Ops/sec
jQuery (#id) 1267465.5 Ops/sec
Cash + getElementsByClassName 716644.1 Ops/sec
Cash + getElementById 995996.1 Ops/sec
Cash (tag.id) 429759.4 Ops/sec
jQuery + getElementById 996095.9 Ops/sec
Cash (tag#id) 395764.6 Ops/sec
Cash (#id) 1422817.4 Ops/sec
querySelectorAll (.id) 1317745.4 Ops/sec
querySelectorAll (#id) 861917.1 Ops/sec
querySelector (.id) 2783571.0 Ops/sec
querySelector (#id) 1632914.1 Ops/sec
getElementsByTagName 2077805.6 Ops/sec
getElementsByClassName 1658420.6 Ops/sec
Cash (.id) 500607.6 Ops/sec
jQuery + getElementsByClassName 438866.4 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