Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36
Chrome 81
Mac OS X 10.13.6
Desktop
4 years ago
Test name Executions per second
getElementById 1431015.0 Ops/sec
jQuery (tag.id) 105805.9 Ops/sec
jQuery (tag#id) 100768.9 Ops/sec
jQuery (.id) 147844.9 Ops/sec
jQuery (#id) 656349.1 Ops/sec
Cash + getElementsByClassName 326834.0 Ops/sec
Cash + getElementById 522083.3 Ops/sec
Cash (tag.id) 156546.5 Ops/sec
jQuery + getElementById 581950.2 Ops/sec
Cash (tag#id) 139098.3 Ops/sec
Cash (#id) 765847.9 Ops/sec
querySelectorAll (.id) 568618.8 Ops/sec
querySelectorAll (#id) 356933.9 Ops/sec
querySelector (.id) 1499175.1 Ops/sec
querySelector (#id) 777962.2 Ops/sec
getElementsByTagName 1165836.9 Ops/sec
getElementsByClassName 979148.4 Ops/sec
Cash (.id) 190397.5 Ops/sec
jQuery + getElementsByClassName 170480.0 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