Run details:
Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G950F Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/9.2 Chrome/67.0.3396.87 Mobile Safari/537.36
Chrome Mobile 67
Android
Mobile
5 years ago
Test name Executions per second
getElementById() 715965.4 Ops/sec
getElementsByClassName() 467093.1 Ops/sec
getElementsByTagName() 500035.6 Ops/sec
querySelector(#id) 451260.7 Ops/sec
querySelector(.id) 490401.6 Ops/sec
querySelectorAll(#id) 223623.3 Ops/sec
querySelectorAll(.id) 275430.0 Ops/sec
jQuery(#id) 296860.8 Ops/sec
jQuery(.id) 153437.7 Ops/sec
jQuery(tag#id) 92599.2 Ops/sec
jQuery(tag.id) 70190.0 Ops/sec
jQuery + getElementById 327013.2 Ops/sec
jQuery + getElementsByClassName 128273.8 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