Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36
Chrome 80
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 460319.9 Ops/sec
jQuery (tag.id) 38524.1 Ops/sec
jQuery (tag#id) 37513.9 Ops/sec
jQuery (.id) 47810.2 Ops/sec
jQuery (#id) 174376.6 Ops/sec
Cash + getElementsByClassName 99691.8 Ops/sec
Cash + getElementById 167295.2 Ops/sec
Cash (tag.id) 66103.8 Ops/sec
jQuery + getElementById 165965.2 Ops/sec
Cash (tag#id) 60994.4 Ops/sec
Cash (#id) 211253.5 Ops/sec
querySelectorAll (.id) 194483.9 Ops/sec
querySelectorAll (#id) 121709.5 Ops/sec
querySelector (.id) 604823.4 Ops/sec
querySelector (#id) 279276.2 Ops/sec
getElementsByTagName 350569.2 Ops/sec
getElementsByClassName 284993.3 Ops/sec
Cash (.id) 70191.3 Ops/sec
jQuery + getElementsByClassName 55489.2 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


;