Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:84.0) Gecko/20100101 Firefox/84.0
Firefox 84
Mac OS X 10.14
Desktop
3 years ago
Test name Executions per second
getElementById 5183733.0 Ops/sec
jQuery (tag.id) 631583.0 Ops/sec
jQuery (tag#id) 602217.2 Ops/sec
jQuery (.id) 1177987.0 Ops/sec
jQuery (#id) 5094326.0 Ops/sec
Cash + getElementsByClassName 1851575.8 Ops/sec
Cash + getElementById 2885586.2 Ops/sec
Cash (tag.id) 999039.3 Ops/sec
jQuery + getElementById 2535292.2 Ops/sec
Cash (tag#id) 828308.9 Ops/sec
Cash (#id) 4379767.0 Ops/sec
querySelectorAll (.id) 1369329.2 Ops/sec
querySelectorAll (#id) 1279566.4 Ops/sec
querySelector (.id) 3779359.0 Ops/sec
querySelector (#id) 3934743.8 Ops/sec
getElementsByTagName 3941114.8 Ops/sec
getElementsByClassName 2807138.5 Ops/sec
Cash (.id) 1564541.1 Ops/sec
jQuery + getElementsByClassName 738032.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