Run details:
Mozilla/5.0 (Linux; Android 8.0.0; MI 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.116 Mobile Safari/537.36
Chrome Mobile 79
Android 8.0.0
Mobile
4 years ago
Test name Executions per second
getElementById() 476188.7 Ops/sec
getElementsByClassName() 254979.7 Ops/sec
getElementsByTagName() 501319.5 Ops/sec
querySelector(#id) 256221.5 Ops/sec
querySelector(.id) 308294.3 Ops/sec
querySelectorAll(#id) 96209.9 Ops/sec
querySelectorAll(.id) 113999.5 Ops/sec
jQuery(#id) 100638.4 Ops/sec
jQuery(.id) 80148.9 Ops/sec
jQuery(tag#id) 54148.2 Ops/sec
jQuery(tag.id) 41424.5 Ops/sec
jQuery + getElementById 198321.9 Ops/sec
jQuery + getElementsByClassName 37653.9 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