Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Chrome 80
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 964045.2 Ops/sec
jQuery (tag.id) 158492.6 Ops/sec
jQuery (tag#id) 146683.2 Ops/sec
jQuery (.id) 207732.8 Ops/sec
jQuery (#id) 692521.0 Ops/sec
Cash + getElementsByClassName 344963.7 Ops/sec
Cash + getElementById 379387.6 Ops/sec
Cash (tag.id) 162498.7 Ops/sec
jQuery + getElementById 517151.7 Ops/sec
Cash (tag#id) 164441.8 Ops/sec
Cash (#id) 558177.4 Ops/sec
querySelectorAll (.id) 621509.4 Ops/sec
querySelectorAll (#id) 355236.6 Ops/sec
querySelector (.id) 1023622.9 Ops/sec
querySelector (#id) 576428.3 Ops/sec
getElementsByTagName 805683.4 Ops/sec
getElementsByClassName 670455.1 Ops/sec
Cash (.id) 214100.6 Ops/sec
jQuery + getElementsByClassName 214749.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