Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
Chrome 81
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 1257921.4 Ops/sec
jQuery (tag.id) 195966.1 Ops/sec
jQuery (tag#id) 190209.1 Ops/sec
jQuery (.id) 243045.5 Ops/sec
jQuery (#id) 764884.2 Ops/sec
Cash + getElementsByClassName 399954.2 Ops/sec
Cash + getElementById 519179.7 Ops/sec
Cash (tag.id) 196742.8 Ops/sec
jQuery + getElementById 604823.2 Ops/sec
Cash (tag#id) 221155.4 Ops/sec
Cash (#id) 787683.9 Ops/sec
querySelectorAll (.id) 707893.0 Ops/sec
querySelectorAll (#id) 453242.6 Ops/sec
querySelector (.id) 1414428.0 Ops/sec
querySelector (#id) 913655.6 Ops/sec
getElementsByTagName 1273524.1 Ops/sec
getElementsByClassName 942976.4 Ops/sec
Cash (.id) 278343.9 Ops/sec
jQuery + getElementsByClassName 217025.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


;