Run details:
Mozilla/5.0 (Android 9; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0
Firefox Mobile 68
Android
Mobile
4 years ago
Test name Executions per second
getElementById() 795542.4 Ops/sec
getElementsByClassName() 630745.8 Ops/sec
getElementsByTagName() 930501.5 Ops/sec
querySelector(#id) 969592.0 Ops/sec
querySelector(.id) 950903.7 Ops/sec
querySelectorAll(#id) 332292.9 Ops/sec
querySelectorAll(.id) 364083.0 Ops/sec
jQuery(#id) 712572.1 Ops/sec
jQuery(.id) 238658.7 Ops/sec
jQuery(tag#id) 141415.0 Ops/sec
jQuery(tag.id) 151620.8 Ops/sec
jQuery + getElementById 568089.8 Ops/sec
jQuery + getElementsByClassName 223959.1 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