Run details:
Mozilla/5.0 (Linux; Android 7.0; VTR-L09) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.136 Mobile Safari/537.36
Chrome Mobile 74
Android 7.0
Mobile
5 years ago
Test name Executions per second
getElementById() 1348982.8 Ops/sec
getElementsByClassName() 867298.6 Ops/sec
getElementsByTagName() 1041933.1 Ops/sec
querySelector(#id) 644239.2 Ops/sec
querySelector(.id) 888529.2 Ops/sec
querySelectorAll(#id) 343661.6 Ops/sec
querySelectorAll(.id) 432229.6 Ops/sec
jQuery(#id) 508157.5 Ops/sec
jQuery(.id) 296540.6 Ops/sec
jQuery(tag#id) 162020.8 Ops/sec
jQuery(tag.id) 168344.5 Ops/sec
jQuery + getElementById 571636.6 Ops/sec
jQuery + getElementsByClassName 224471.2 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