Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36
Chrome 80
Mac OS X 10.15.3
Desktop
4 years ago
Test name Executions per second
getElementById 2896681.5 Ops/sec
jQuery (tag.id) 391401.8 Ops/sec
jQuery (tag#id) 333115.1 Ops/sec
jQuery (.id) 456039.5 Ops/sec
jQuery (#id) 1626051.1 Ops/sec
Cash + getElementsByClassName 935303.4 Ops/sec
Cash + getElementById 1111799.6 Ops/sec
Cash (tag.id) 482642.4 Ops/sec
jQuery + getElementById 1276773.6 Ops/sec
Cash (tag#id) 415751.7 Ops/sec
Cash (#id) 1896725.4 Ops/sec
querySelectorAll (.id) 1352058.4 Ops/sec
querySelectorAll (#id) 809853.4 Ops/sec
querySelector (.id) 2813301.5 Ops/sec
querySelector (#id) 1695422.8 Ops/sec
getElementsByTagName 2561464.0 Ops/sec
getElementsByClassName 1930409.8 Ops/sec
Cash (.id) 627931.4 Ops/sec
jQuery + getElementsByClassName 556780.6 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