Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Chrome 83
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2611411.2 Ops/sec
jQuery (tag.id) 294283.1 Ops/sec
jQuery (tag#id) 285235.4 Ops/sec
jQuery (.id) 459988.3 Ops/sec
jQuery (#id) 1244681.9 Ops/sec
Cash + getElementsByClassName 813645.1 Ops/sec
Cash + getElementById 1025723.6 Ops/sec
Cash (tag.id) 390582.1 Ops/sec
jQuery + getElementById 1020147.6 Ops/sec
Cash (tag#id) 363358.2 Ops/sec
Cash (#id) 1562516.8 Ops/sec
querySelectorAll (.id) 1069815.5 Ops/sec
querySelectorAll (#id) 818981.5 Ops/sec
querySelector (.id) 2739132.5 Ops/sec
querySelector (#id) 1645766.4 Ops/sec
getElementsByTagName 2016987.8 Ops/sec
getElementsByClassName 1743904.0 Ops/sec
Cash (.id) 493110.8 Ops/sec
jQuery + getElementsByClassName 417658.9 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


;