Run details:
Mozilla/5.0 (Linux; Android 6.0; vivo 1601) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.93 Mobile Safari/537.36
Chrome Mobile 79
Android 6.0
Mobile
4 years ago
Test name Executions per second
getElementById() 310918.2 Ops/sec
getElementsByClassName() 166187.1 Ops/sec
getElementsByTagName() 228956.9 Ops/sec
querySelector(#id) 163843.5 Ops/sec
querySelector(.id) 242500.0 Ops/sec
querySelectorAll(#id) 119463.6 Ops/sec
querySelectorAll(.id) 147047.2 Ops/sec
jQuery(#id) 89778.6 Ops/sec
jQuery(.id) 51821.1 Ops/sec
jQuery(tag#id) 36793.5 Ops/sec
jQuery(tag.id) 36107.6 Ops/sec
jQuery + getElementById 117020.0 Ops/sec
jQuery + getElementsByClassName 39293.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


;