Run details:
Mozilla/5.0 (Linux; Android 7.1.1; Moto G (5S)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Mobile Safari/537.36
Chrome Mobile 104
Android 7.1.1
Mobile
2 years ago
Test name Executions per second
getElementById 331929.6 Ops/sec
jQuery (tag.id) 53065.4 Ops/sec
jQuery (tag#id) 50280.0 Ops/sec
jQuery (.id) 75641.5 Ops/sec
jQuery (#id) 115612.0 Ops/sec
Cash + getElementsByClassName 111024.3 Ops/sec
Cash + getElementById 149970.2 Ops/sec
Cash (tag.id) 96284.0 Ops/sec
jQuery + getElementById 156417.8 Ops/sec
Cash (tag#id) 80322.0 Ops/sec
Cash (#id) 134593.8 Ops/sec
querySelectorAll (.id) 174031.1 Ops/sec
querySelectorAll (#id) 134894.9 Ops/sec
querySelector (.id) 282425.3 Ops/sec
querySelector (#id) 216069.1 Ops/sec
getElementsByTagName 277814.0 Ops/sec
getElementsByClassName 222850.3 Ops/sec
Cash (.id) 107349.5 Ops/sec
jQuery + getElementsByClassName 62413.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