Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36
Chrome 96
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
getElementById 3669246.0 Ops/sec
jQuery (tag.id) 501639.6 Ops/sec
jQuery (tag#id) 478276.2 Ops/sec
jQuery (.id) 673187.8 Ops/sec
jQuery (#id) 1837895.2 Ops/sec
Cash + getElementsByClassName 1100374.9 Ops/sec
Cash + getElementById 1399957.2 Ops/sec
Cash (tag.id) 762446.8 Ops/sec
jQuery + getElementById 1515243.1 Ops/sec
Cash (tag#id) 620105.5 Ops/sec
Cash (#id) 2104294.0 Ops/sec
querySelectorAll (.id) 1903677.9 Ops/sec
querySelectorAll (#id) 1237301.6 Ops/sec
querySelector (.id) 3860116.2 Ops/sec
querySelector (#id) 2046492.6 Ops/sec
getElementsByTagName 3169210.0 Ops/sec
getElementsByClassName 2469390.5 Ops/sec
Cash (.id) 923203.6 Ops/sec
jQuery + getElementsByClassName 576073.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