Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0
Firefox 98
Windows
Desktop
2 years ago
Test name Executions per second
getElementById 5329391.5 Ops/sec
jQuery (tag.id) 698577.9 Ops/sec
jQuery (tag#id) 605548.9 Ops/sec
jQuery (.id) 1080300.0 Ops/sec
jQuery (#id) 5256202.5 Ops/sec
Cash + getElementsByClassName 1765494.2 Ops/sec
Cash + getElementById 3135117.2 Ops/sec
Cash (tag.id) 1067961.2 Ops/sec
jQuery + getElementById 3442551.2 Ops/sec
Cash (tag#id) 960052.9 Ops/sec
Cash (#id) 5330707.0 Ops/sec
querySelectorAll (.id) 1378376.2 Ops/sec
querySelectorAll (#id) 1176564.9 Ops/sec
querySelector (.id) 3403716.8 Ops/sec
querySelector (#id) 3321012.2 Ops/sec
getElementsByTagName 3733221.8 Ops/sec
getElementsByClassName 2575033.0 Ops/sec
Cash (.id) 1755022.4 Ops/sec
jQuery + getElementsByClassName 857055.3 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