Run details:
Mozilla/5.0 (Linux; Android 9; MI 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.90 Mobile Safari/537.36
Chrome Mobile 73
Android
Mobile
5 years ago
Test name Executions per second
getElementById() 2128645.5 Ops/sec
getElementsByClassName() 1355560.6 Ops/sec
getElementsByTagName() 1595307.8 Ops/sec
querySelector(#id) 919378.0 Ops/sec
querySelector(.id) 1392173.4 Ops/sec
querySelectorAll(#id) 524096.5 Ops/sec
querySelectorAll(.id) 644316.9 Ops/sec
jQuery(#id) 739910.8 Ops/sec
jQuery(.id) 488073.5 Ops/sec
jQuery(tag#id) 223391.8 Ops/sec
jQuery(tag.id) 261236.7 Ops/sec
jQuery + getElementById 827786.8 Ops/sec
jQuery + getElementsByClassName 331621.2 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