Run details:
Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.117 Mobile Safari/537.36
Chrome Mobile 81
Android
Mobile
4 years ago
Test name Executions per second
getElementById 2297748.2 Ops/sec
jQuery (tag.id) 265222.0 Ops/sec
jQuery (tag#id) 245514.6 Ops/sec
jQuery (.id) 477133.6 Ops/sec
jQuery (#id) 639774.1 Ops/sec
Cash + getElementsByClassName 297341.9 Ops/sec
Cash + getElementById 813374.5 Ops/sec
Cash (tag.id) 439874.0 Ops/sec
jQuery + getElementById 901583.6 Ops/sec
Cash (tag#id) 378025.3 Ops/sec
Cash (#id) 735307.8 Ops/sec
querySelectorAll (.id) 716663.1 Ops/sec
querySelectorAll (#id) 551654.8 Ops/sec
querySelector (.id) 1373179.9 Ops/sec
querySelector (#id) 1126230.1 Ops/sec
getElementsByTagName 1561268.4 Ops/sec
getElementsByClassName 1242656.2 Ops/sec
Cash (.id) 614780.6 Ops/sec
jQuery + getElementsByClassName 307128.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