Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
Chrome 89
Mac OS X 10.13.6
Desktop
3 years ago
Test name Executions per second
getElementById 3188915.8 Ops/sec
jQuery (tag.id) 505547.1 Ops/sec
jQuery (tag#id) 464206.5 Ops/sec
jQuery (.id) 808850.5 Ops/sec
jQuery (#id) 1666960.1 Ops/sec
Cash + getElementsByClassName 897373.0 Ops/sec
Cash + getElementById 1276422.1 Ops/sec
Cash (tag.id) 786398.5 Ops/sec
jQuery + getElementById 1403086.6 Ops/sec
Cash (tag#id) 663714.4 Ops/sec
Cash (#id) 1810790.5 Ops/sec
querySelectorAll (.id) 1397949.9 Ops/sec
querySelectorAll (#id) 1064124.6 Ops/sec
querySelector (.id) 2638752.0 Ops/sec
querySelector (#id) 1827828.5 Ops/sec
getElementsByTagName 2675176.2 Ops/sec
getElementsByClassName 1752064.5 Ops/sec
Cash (.id) 976452.2 Ops/sec
jQuery + getElementsByClassName 551298.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