Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:94.0) Gecko/20100101 Firefox/94.0
Firefox 94
Mac OS X 10.15
Desktop
3 years ago
Test name Executions per second
getElementById 5308087.0 Ops/sec
jQuery (tag.id) 648724.8 Ops/sec
jQuery (tag#id) 606589.7 Ops/sec
jQuery (.id) 1096991.0 Ops/sec
jQuery (#id) 4614104.5 Ops/sec
Cash + getElementsByClassName 1637068.5 Ops/sec
Cash + getElementById 2737110.2 Ops/sec
Cash (tag.id) 916957.8 Ops/sec
jQuery + getElementById 3058546.0 Ops/sec
Cash (tag#id) 815668.4 Ops/sec
Cash (#id) 4518187.0 Ops/sec
querySelectorAll (.id) 1226541.5 Ops/sec
querySelectorAll (#id) 1118729.5 Ops/sec
querySelector (.id) 3309152.0 Ops/sec
querySelector (#id) 3273292.0 Ops/sec
getElementsByTagName 4033582.0 Ops/sec
getElementsByClassName 2743065.8 Ops/sec
Cash (.id) 1595093.0 Ops/sec
jQuery + getElementsByClassName 825529.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