Run details:
Mozilla/5.0 (Linux; arm_64; Android 8.0.0; SM-G930S) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.136 YaBrowser/20.2.4.139.00 Mobile Safari/537.36
Yandex Browser 20
Android 8.0.0
Mobile
4 years ago
Test name Executions per second
getElementById 1377602.2 Ops/sec
jQuery (tag.id) 106771.1 Ops/sec
jQuery (tag#id) 108862.6 Ops/sec
jQuery (.id) 176431.6 Ops/sec
jQuery (#id) 350185.4 Ops/sec
Cash + getElementsByClassName 320904.5 Ops/sec
Cash + getElementById 493674.7 Ops/sec
Cash (tag.id) 182785.9 Ops/sec
jQuery + getElementById 552458.1 Ops/sec
Cash (tag#id) 176714.1 Ops/sec
Cash (#id) 436763.5 Ops/sec
querySelectorAll (.id) 312273.9 Ops/sec
querySelectorAll (#id) 272030.2 Ops/sec
querySelector (.id) 1019743.3 Ops/sec
querySelector (#id) 799074.0 Ops/sec
getElementsByTagName 1124521.4 Ops/sec
getElementsByClassName 908880.9 Ops/sec
Cash (.id) 242159.2 Ops/sec
jQuery + getElementsByClassName 175261.5 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