Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 1392148.4 Ops/sec
jQuery (tag.id) 191079.1 Ops/sec
jQuery (tag#id) 189725.2 Ops/sec
jQuery (.id) 231868.7 Ops/sec
jQuery (#id) 785678.8 Ops/sec
Cash + getElementsByClassName 426185.6 Ops/sec
Cash + getElementById 566271.9 Ops/sec
Cash (tag.id) 244942.1 Ops/sec
jQuery + getElementById 629618.6 Ops/sec
Cash (tag#id) 228391.8 Ops/sec
Cash (#id) 843336.2 Ops/sec
querySelectorAll (.id) 710812.3 Ops/sec
querySelectorAll (#id) 483806.2 Ops/sec
querySelector (.id) 1260277.9 Ops/sec
querySelector (#id) 839935.5 Ops/sec
getElementsByTagName 1075025.1 Ops/sec
getElementsByClassName 920923.5 Ops/sec
Cash (.id) 288804.2 Ops/sec
jQuery + getElementsByClassName 246223.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