Run details:
Mozilla/5.0 (Linux; Android 9; Mi 9T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36
Chrome Mobile 78
Android
Mobile
5 years ago
Test name Executions per second
getElementById() 1802905.0 Ops/sec
getElementsByClassName() 975313.0 Ops/sec
getElementsByTagName() 1158499.2 Ops/sec
querySelector(#id) 1004103.2 Ops/sec
querySelector(.id) 1176149.8 Ops/sec
querySelectorAll(#id) 533088.9 Ops/sec
querySelectorAll(.id) 663401.4 Ops/sec
jQuery(#id) 638693.9 Ops/sec
jQuery(.id) 388091.6 Ops/sec
jQuery(tag#id) 232736.2 Ops/sec
jQuery(tag.id) 247814.7 Ops/sec
jQuery + getElementById 818424.0 Ops/sec
jQuery + getElementsByClassName 261280.7 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