Run details:
Mozilla/5.0 (Linux; Android 9; CLT-L09) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.116 Mobile Safari/537.36
Chrome Mobile 79
Android
Mobile
4 years ago
Test name Executions per second
getElementById() 1276221.0 Ops/sec
getElementsByClassName() 872370.7 Ops/sec
getElementsByTagName() 782830.7 Ops/sec
querySelector(#id) 657834.0 Ops/sec
querySelector(.id) 830008.2 Ops/sec
querySelectorAll(#id) 388060.8 Ops/sec
querySelectorAll(.id) 506395.1 Ops/sec
jQuery(#id) 351424.3 Ops/sec
jQuery(.id) 230700.3 Ops/sec
jQuery(tag#id) 152854.9 Ops/sec
jQuery(tag.id) 169531.5 Ops/sec
jQuery + getElementById 604357.8 Ops/sec
jQuery + getElementsByClassName 219211.3 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