Run details:
Mozilla/5.0 (Linux; Android 5.0.1; GEM-701L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.90 Mobile Safari/537.36
Chrome Mobile 73
Android 5.0.1
Mobile
5 years ago
Test name Executions per second
getElementById() 582398.4 Ops/sec
getElementsByClassName() 365771.8 Ops/sec
getElementsByTagName() 447366.9 Ops/sec
querySelector(#id) 270301.5 Ops/sec
querySelector(.id) 391298.0 Ops/sec
querySelectorAll(#id) 186075.7 Ops/sec
querySelectorAll(.id) 188392.5 Ops/sec
jQuery(#id) 199523.0 Ops/sec
jQuery(.id) 128099.1 Ops/sec
jQuery(tag#id) 73807.5 Ops/sec
jQuery(tag.id) 76357.3 Ops/sec
jQuery + getElementById 240431.3 Ops/sec
jQuery + getElementsByClassName 93606.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