Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36 Edg/86.0.622.51
Chrome 86
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3607885.2 Ops/sec
jQuery (tag.id) 444786.7 Ops/sec
jQuery (tag#id) 423551.3 Ops/sec
jQuery (.id) 653093.7 Ops/sec
jQuery (#id) 1952036.0 Ops/sec
Cash + getElementsByClassName 1113471.9 Ops/sec
Cash + getElementById 1449808.8 Ops/sec
Cash (tag.id) 544583.6 Ops/sec
jQuery + getElementById 1529221.9 Ops/sec
Cash (tag#id) 480761.4 Ops/sec
Cash (#id) 2174235.8 Ops/sec
querySelectorAll (.id) 1603926.9 Ops/sec
querySelectorAll (#id) 1098251.2 Ops/sec
querySelector (.id) 2976207.0 Ops/sec
querySelector (#id) 1770699.9 Ops/sec
getElementsByTagName 3037687.5 Ops/sec
getElementsByClassName 2412930.8 Ops/sec
Cash (.id) 711991.4 Ops/sec
jQuery + getElementsByClassName 675331.3 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