Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1
Mobile Safari 15
iOS 15.0
Mobile
3 years ago
Test name Executions per second
getElementById 6607746.0 Ops/sec
jQuery (tag.id) 155286.9 Ops/sec
jQuery (tag#id) 150502.6 Ops/sec
jQuery (.id) 256984.3 Ops/sec
jQuery (#id) 361813.6 Ops/sec
Cash + getElementsByClassName 249103.7 Ops/sec
Cash + getElementById 495294.1 Ops/sec
Cash (tag.id) 1195615.9 Ops/sec
jQuery + getElementById 355740.9 Ops/sec
Cash (tag#id) 1628717.8 Ops/sec
Cash (#id) 3604804.0 Ops/sec
querySelectorAll (.id) 3438640.8 Ops/sec
querySelectorAll (#id) 2931671.5 Ops/sec
querySelector (.id) 5039964.5 Ops/sec
querySelector (#id) 4350631.0 Ops/sec
getElementsByTagName 5642504.0 Ops/sec
getElementsByClassName 5719850.0 Ops/sec
Cash (.id) 2365153.5 Ops/sec
jQuery + getElementsByClassName 240524.7 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


;