Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/70.0.3538.75 Mobile/15E148 Safari/605.1
Chrome Mobile iOS 70
iOS 12.1
Mobile
6 years ago
Test name Executions per second
getElementById() 909999.5 Ops/sec
getElementsByClassName() 651695.4 Ops/sec
getElementsByTagName() 679758.4 Ops/sec
querySelector(#id) 579262.9 Ops/sec
querySelector(.id) 640944.4 Ops/sec
querySelectorAll(#id) 402764.2 Ops/sec
querySelectorAll(.id) 414856.0 Ops/sec
jQuery(#id) 409548.0 Ops/sec
jQuery(.id) 120528.7 Ops/sec
jQuery(tag#id) 114700.4 Ops/sec
jQuery(tag.id) 111643.0 Ops/sec
jQuery + getElementById 416450.7 Ops/sec
jQuery + getElementsByClassName 235866.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


;