Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36
Chrome 86
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2056730.5 Ops/sec
jQuery (tag.id) 261835.4 Ops/sec
jQuery (tag#id) 242141.3 Ops/sec
jQuery (.id) 326547.2 Ops/sec
jQuery (#id) 935982.8 Ops/sec
Cash + getElementsByClassName 533951.8 Ops/sec
Cash + getElementById 768027.5 Ops/sec
Cash (tag.id) 319420.3 Ops/sec
jQuery + getElementById 758551.1 Ops/sec
Cash (tag#id) 296591.0 Ops/sec
Cash (#id) 1034197.1 Ops/sec
querySelectorAll (.id) 950606.6 Ops/sec
querySelectorAll (#id) 613881.1 Ops/sec
querySelector (.id) 2217999.8 Ops/sec
querySelector (#id) 1210101.1 Ops/sec
getElementsByTagName 1520997.4 Ops/sec
getElementsByClassName 1216427.2 Ops/sec
Cash (.id) 390821.9 Ops/sec
jQuery + getElementsByClassName 347545.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


;