Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36
Chrome 118
Windows
Desktop
one year ago
Test name Executions per second
getElementById 5937618.0 Ops/sec
jQuery (tag.id) 675554.8 Ops/sec
jQuery (tag#id) 637422.6 Ops/sec
jQuery (.id) 988241.2 Ops/sec
jQuery (#id) 1698441.1 Ops/sec
Cash + getElementsByClassName 1121479.5 Ops/sec
Cash + getElementById 1935461.6 Ops/sec
Cash (tag.id) 1128924.5 Ops/sec
jQuery + getElementById 2234397.8 Ops/sec
Cash (tag#id) 858026.2 Ops/sec
Cash (#id) 2237567.0 Ops/sec
querySelectorAll (.id) 2161397.8 Ops/sec
querySelectorAll (#id) 1321687.8 Ops/sec
querySelector (.id) 3819016.0 Ops/sec
querySelector (#id) 2348440.5 Ops/sec
getElementsByTagName 4295843.5 Ops/sec
getElementsByClassName 3371754.2 Ops/sec
Cash (.id) 1221618.4 Ops/sec
jQuery + getElementsByClassName 702764.1 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