Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Mobile/15E148 Safari/604.1
Mobile Safari 14
iOS 14.3
Mobile
3 years ago
Test name Executions per second
getElementById 5116309.5 Ops/sec
jQuery (tag.id) 779164.5 Ops/sec
jQuery (tag#id) 799512.1 Ops/sec
jQuery (.id) 923098.9 Ops/sec
jQuery (#id) 1745137.9 Ops/sec
Cash + getElementsByClassName 1438642.2 Ops/sec
Cash + getElementById 1773856.1 Ops/sec
Cash (tag.id) 1062048.0 Ops/sec
jQuery + getElementById 3066764.0 Ops/sec
Cash (tag#id) 1172637.6 Ops/sec
Cash (#id) 1909240.2 Ops/sec
querySelectorAll (.id) 2115606.2 Ops/sec
querySelectorAll (#id) 2132633.0 Ops/sec
querySelector (.id) 3425554.0 Ops/sec
querySelector (#id) 2746212.2 Ops/sec
getElementsByTagName 2981196.8 Ops/sec
getElementsByClassName 3730104.8 Ops/sec
Cash (.id) 1583828.0 Ops/sec
jQuery + getElementsByClassName 1832924.5 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