Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Chrome 80
Mac OS X 10.15.4
Desktop
4 years ago
Test name Executions per second
getElementById 2707077.5 Ops/sec
jQuery (tag.id) 346525.3 Ops/sec
jQuery (tag#id) 315872.4 Ops/sec
jQuery (.id) 462300.8 Ops/sec
jQuery (#id) 1455464.4 Ops/sec
Cash + getElementsByClassName 831017.9 Ops/sec
Cash + getElementById 1089668.8 Ops/sec
Cash (tag.id) 422843.7 Ops/sec
jQuery + getElementById 1131780.9 Ops/sec
Cash (tag#id) 384503.1 Ops/sec
Cash (#id) 1481772.0 Ops/sec
querySelectorAll (.id) 1352333.0 Ops/sec
querySelectorAll (#id) 917460.8 Ops/sec
querySelector (.id) 2651440.2 Ops/sec
querySelector (#id) 1404332.2 Ops/sec
getElementsByTagName 2187497.2 Ops/sec
getElementsByClassName 1839315.0 Ops/sec
Cash (.id) 560508.9 Ops/sec
jQuery + getElementsByClassName 465557.7 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