Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36
Chrome 89
Linux
Desktop
3 years ago
Test name Executions per second
getElementById 2626529.5 Ops/sec
jQuery (tag.id) 439643.6 Ops/sec
jQuery (tag#id) 405897.9 Ops/sec
jQuery (.id) 651385.6 Ops/sec
jQuery (#id) 1410377.6 Ops/sec
Cash + getElementsByClassName 710015.4 Ops/sec
Cash + getElementById 1168157.0 Ops/sec
Cash (tag.id) 707359.3 Ops/sec
jQuery + getElementById 1209987.8 Ops/sec
Cash (tag#id) 607385.8 Ops/sec
Cash (#id) 1639094.1 Ops/sec
querySelectorAll (.id) 1384239.9 Ops/sec
querySelectorAll (#id) 1043300.2 Ops/sec
querySelector (.id) 2248242.0 Ops/sec
querySelector (#id) 1651881.5 Ops/sec
getElementsByTagName 2181245.2 Ops/sec
getElementsByClassName 1397399.2 Ops/sec
Cash (.id) 789545.7 Ops/sec
jQuery + getElementsByClassName 443730.0 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