Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
Chrome 84
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2604047.0 Ops/sec
jQuery (tag.id) 338603.8 Ops/sec
jQuery (tag#id) 324172.2 Ops/sec
jQuery (.id) 475055.8 Ops/sec
jQuery (#id) 1452161.5 Ops/sec
Cash + getElementsByClassName 756517.7 Ops/sec
Cash + getElementById 1045165.9 Ops/sec
Cash (tag.id) 437621.2 Ops/sec
jQuery + getElementById 1131658.2 Ops/sec
Cash (tag#id) 388829.5 Ops/sec
Cash (#id) 1606746.1 Ops/sec
querySelectorAll (.id) 1245898.2 Ops/sec
querySelectorAll (#id) 912585.3 Ops/sec
querySelector (.id) 2646993.0 Ops/sec
querySelector (#id) 1545186.2 Ops/sec
getElementsByTagName 2108448.0 Ops/sec
getElementsByClassName 1690591.6 Ops/sec
Cash (.id) 529530.6 Ops/sec
jQuery + getElementsByClassName 453524.7 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


;