Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15
Safari 14
Mac OS X 10.15.6
Desktop
3 years ago
Test name Executions per second
getElementById 5175935.0 Ops/sec
jQuery (tag.id) 951128.2 Ops/sec
jQuery (tag#id) 948463.9 Ops/sec
jQuery (.id) 1285657.2 Ops/sec
jQuery (#id) 2511877.8 Ops/sec
Cash + getElementsByClassName 1833442.2 Ops/sec
Cash + getElementById 2101951.0 Ops/sec
Cash (tag.id) 1306751.1 Ops/sec
jQuery + getElementById 2278072.5 Ops/sec
Cash (tag#id) 1350220.9 Ops/sec
Cash (#id) 2422584.8 Ops/sec
querySelectorAll (.id) 2383186.2 Ops/sec
querySelectorAll (#id) 2301801.8 Ops/sec
querySelector (.id) 3769016.5 Ops/sec
querySelector (#id) 3553963.8 Ops/sec
getElementsByTagName 4281365.0 Ops/sec
getElementsByClassName 4100893.8 Ops/sec
Cash (.id) 1647584.0 Ops/sec
jQuery + getElementsByClassName 1461996.6 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


;