Run details:
Mozilla/5.0 (Linux; Android 10; Pixel 3 XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Mobile Safari/537.36
Chrome Mobile 79
Android
Mobile
4 years ago
Test name Executions per second
getElementById() 2077037.8 Ops/sec
getElementsByClassName() 1161082.8 Ops/sec
getElementsByTagName() 1575246.6 Ops/sec
querySelector(#id) 1168710.2 Ops/sec
querySelector(.id) 1582743.6 Ops/sec
querySelectorAll(#id) 565776.9 Ops/sec
querySelectorAll(.id) 746795.0 Ops/sec
jQuery(#id) 722772.3 Ops/sec
jQuery(.id) 441799.6 Ops/sec
jQuery(tag#id) 251262.1 Ops/sec
jQuery(tag.id) 253254.0 Ops/sec
jQuery + getElementById 890406.1 Ops/sec
jQuery + getElementsByClassName 302425.8 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


;