Run details:
Mozilla/5.0 (Linux; Android 7.0; Moto G (5) Plus Build/NPNS25.137-93-10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Mobile Safari/537.36
Chrome Mobile 67
Android 7.0
Mobile
6 years ago
Test name Executions per second
getElementById() 513443.6 Ops/sec
getElementsByClassName() 337055.5 Ops/sec
getElementsByTagName() 404184.1 Ops/sec
querySelector(#id) 299413.0 Ops/sec
querySelector(.id) 374655.7 Ops/sec
querySelectorAll(#id) 173036.7 Ops/sec
querySelectorAll(.id) 198257.2 Ops/sec
jQuery(#id) 176307.2 Ops/sec
jQuery(.id) 98657.0 Ops/sec
jQuery(tag#id) 60907.1 Ops/sec
jQuery(tag.id) 60707.2 Ops/sec
jQuery + getElementById 209530.0 Ops/sec
jQuery + getElementsByClassName 73365.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