Run details:
Mozilla/5.0 (Linux; Android 7.0; VTR-L09) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.73 Mobile Safari/537.36
Chrome Mobile 77
Android 7.0
Mobile
5 years ago
Test name Executions per second
getElementById() 1322601.9 Ops/sec
getElementsByClassName() 773390.8 Ops/sec
getElementsByTagName() 1005610.1 Ops/sec
querySelector(#id) 744514.6 Ops/sec
querySelector(.id) 854938.7 Ops/sec
querySelectorAll(#id) 402379.1 Ops/sec
querySelectorAll(.id) 489512.1 Ops/sec
jQuery(#id) 488624.3 Ops/sec
jQuery(.id) 293673.8 Ops/sec
jQuery(tag#id) 179950.5 Ops/sec
jQuery(tag.id) 195062.3 Ops/sec
jQuery + getElementById 568816.6 Ops/sec
jQuery + getElementsByClassName 201079.9 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