Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:74.0) Gecko/20100101 Firefox/74.0
Firefox 74
Mac OS X 10.15
Desktop
4 years ago
Test name Executions per second
getElementById 3666803.0 Ops/sec
jQuery (tag.id) 547544.7 Ops/sec
jQuery (tag#id) 490465.3 Ops/sec
jQuery (.id) 845939.1 Ops/sec
jQuery (#id) 4330826.0 Ops/sec
Cash + getElementsByClassName 1471359.5 Ops/sec
Cash + getElementById 2527248.2 Ops/sec
Cash (tag.id) 1018785.4 Ops/sec
jQuery + getElementById 2578897.5 Ops/sec
Cash (tag#id) 848598.1 Ops/sec
Cash (#id) 5185781.5 Ops/sec
querySelectorAll (.id) 1187618.6 Ops/sec
querySelectorAll (#id) 1125054.2 Ops/sec
querySelector (.id) 2784650.5 Ops/sec
querySelector (#id) 2821335.5 Ops/sec
getElementsByTagName 2933090.0 Ops/sec
getElementsByClassName 2180862.5 Ops/sec
Cash (.id) 1725988.4 Ops/sec
jQuery + getElementsByClassName 789922.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


;