Run details:
Mozilla/5.0 (Linux; Android 4.4.2; GT-I9192) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.143 Mobile Safari/537.36
Chrome Mobile 75
Android 4.4.2
Mobile
5 years ago
Test name Executions per second
getElementById() 262149.3 Ops/sec
getElementsByClassName() 169238.3 Ops/sec
getElementsByTagName() 197842.6 Ops/sec
querySelector(#id) 173247.0 Ops/sec
querySelector(.id) 155091.0 Ops/sec
querySelectorAll(#id) 53553.2 Ops/sec
querySelectorAll(.id) 58318.5 Ops/sec
jQuery(#id) 44164.8 Ops/sec
jQuery(.id) 31578.0 Ops/sec
jQuery(tag#id) 20519.1 Ops/sec
jQuery(tag.id) 16676.9 Ops/sec
jQuery + getElementById 83368.8 Ops/sec
jQuery + getElementsByClassName 23148.5 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