Run details:
Mozilla/5.0 (Linux; Android 9; STF-L09) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.143 Mobile Safari/537.36
Chrome Mobile 75
Android
Mobile
5 years ago
Test name Executions per second
getElementById() 1198946.0 Ops/sec
getElementsByClassName() 844766.2 Ops/sec
getElementsByTagName() 965000.6 Ops/sec
querySelector(#id) 767416.6 Ops/sec
querySelector(.id) 881794.2 Ops/sec
querySelectorAll(#id) 418472.2 Ops/sec
querySelectorAll(.id) 516219.5 Ops/sec
jQuery(#id) 493476.4 Ops/sec
jQuery(.id) 298431.8 Ops/sec
jQuery(tag#id) 181463.8 Ops/sec
jQuery(tag.id) 174297.3 Ops/sec
jQuery + getElementById 548821.7 Ops/sec
jQuery + getElementsByClassName 221863.4 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


;