Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36
Chrome 87
Mac OS X 11.1.0
Desktop
3 years ago
Test name Executions per second
getElementById 1077156.2 Ops/sec
jQuery (tag.id) 172897.4 Ops/sec
jQuery (tag#id) 165141.0 Ops/sec
jQuery (.id) 239864.3 Ops/sec
jQuery (#id) 778400.2 Ops/sec
Cash + getElementsByClassName 515833.4 Ops/sec
Cash + getElementById 624293.1 Ops/sec
Cash (tag.id) 237074.0 Ops/sec
jQuery + getElementById 623570.5 Ops/sec
Cash (tag#id) 294568.0 Ops/sec
Cash (#id) 595890.6 Ops/sec
querySelectorAll (.id) 968503.6 Ops/sec
querySelectorAll (#id) 426883.9 Ops/sec
querySelector (.id) 984023.6 Ops/sec
querySelector (#id) 739887.2 Ops/sec
getElementsByTagName 820126.9 Ops/sec
getElementsByClassName 813416.1 Ops/sec
Cash (.id) 383523.8 Ops/sec
jQuery + getElementsByClassName 350176.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