Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
Chrome 81
Mac OS X 10.15.5
Desktop
4 years ago
Test name Executions per second
getElementById 2051209.8 Ops/sec
jQuery (tag.id) 138054.4 Ops/sec
jQuery (tag#id) 136030.4 Ops/sec
jQuery (.id) 184450.2 Ops/sec
jQuery (#id) 807972.9 Ops/sec
Cash + getElementsByClassName 402647.0 Ops/sec
Cash + getElementById 713000.6 Ops/sec
Cash (tag.id) 217687.0 Ops/sec
jQuery + getElementById 773885.9 Ops/sec
Cash (tag#id) 200720.2 Ops/sec
Cash (#id) 1032192.1 Ops/sec
querySelectorAll (.id) 743150.7 Ops/sec
querySelectorAll (#id) 526190.3 Ops/sec
querySelector (.id) 2160550.8 Ops/sec
querySelector (#id) 1149058.9 Ops/sec
getElementsByTagName 1623375.1 Ops/sec
getElementsByClassName 1331943.0 Ops/sec
Cash (.id) 258503.7 Ops/sec
jQuery + getElementsByClassName 206122.5 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