Run details:
Mozilla/5.0 (Linux; Android 9; COL-L29 Build/HUAWEICOL-L29; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/79.0.3945.116 Mobile Safari/537.36 [FB_IAB/Orca-Android;FBAV/247.0.0.10.117;]
Chrome Mobile 79
Android
Mobile
4 years ago
Test name Executions per second
getElementById() 1586564.8 Ops/sec
getElementsByClassName() 820528.0 Ops/sec
getElementsByTagName() 921039.6 Ops/sec
querySelector(#id) 695242.4 Ops/sec
querySelector(.id) 862751.5 Ops/sec
querySelectorAll(#id) 336755.0 Ops/sec
querySelectorAll(.id) 428026.2 Ops/sec
jQuery(#id) 373831.4 Ops/sec
jQuery(.id) 258737.4 Ops/sec
jQuery(tag#id) 161512.3 Ops/sec
jQuery(tag.id) 157777.2 Ops/sec
jQuery + getElementById 518804.4 Ops/sec
jQuery + getElementsByClassName 184175.7 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