Run details:
Mozilla/5.0 (Linux; Android 7.0; VTR-L09) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.136 Mobile Safari/537.36
Chrome Mobile 74
Android 7.0
Mobile
5 years ago
Test name Executions per second
getElementById() 1386794.1 Ops/sec
getElementsByClassName() 866011.6 Ops/sec
getElementsByTagName() 1042575.6 Ops/sec
querySelector(#id) 654317.2 Ops/sec
querySelector(.id) 889659.3 Ops/sec
querySelectorAll(#id) 357251.0 Ops/sec
querySelectorAll(.id) 462167.4 Ops/sec
jQuery(#id) 508901.6 Ops/sec
jQuery(.id) 282370.0 Ops/sec
jQuery(tag#id) 163956.8 Ops/sec
jQuery(tag.id) 172017.9 Ops/sec
jQuery + getElementById 582404.1 Ops/sec
jQuery + getElementsByClassName 227363.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