Run details:
Mozilla/5.0 (Linux; Android 9; ONEPLUS A6000 Build/PKQ1.180716.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/206.0.0.2.105;]
Chrome Mobile 71
Android
Mobile
5 years ago
Test name Executions per second
getElementById() 1726501.4 Ops/sec
getElementsByClassName() 1129194.0 Ops/sec
getElementsByTagName() 1408012.6 Ops/sec
querySelector(#id) 909681.3 Ops/sec
querySelector(.id) 1294803.6 Ops/sec
querySelectorAll(#id) 461948.3 Ops/sec
querySelectorAll(.id) 565930.7 Ops/sec
jQuery(#id) 743523.4 Ops/sec
jQuery(.id) 443171.2 Ops/sec
jQuery(tag#id) 233437.8 Ops/sec
jQuery(tag.id) 234002.1 Ops/sec
jQuery + getElementById 823952.8 Ops/sec
jQuery + getElementsByClassName 322862.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