Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0
Firefox 77
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3521020.5 Ops/sec
jQuery (tag.id) 572474.9 Ops/sec
jQuery (tag#id) 448949.2 Ops/sec
jQuery (.id) 794452.4 Ops/sec
jQuery (#id) 3382922.8 Ops/sec
Cash + getElementsByClassName 1277034.1 Ops/sec
Cash + getElementById 2017671.1 Ops/sec
Cash (tag.id) 709076.5 Ops/sec
jQuery + getElementById 2545202.5 Ops/sec
Cash (tag#id) 762159.8 Ops/sec
Cash (#id) 3811263.0 Ops/sec
querySelectorAll (.id) 831012.1 Ops/sec
querySelectorAll (#id) 776137.6 Ops/sec
querySelector (.id) 2784043.2 Ops/sec
querySelector (#id) 2744374.5 Ops/sec
getElementsByTagName 2778063.0 Ops/sec
getElementsByClassName 2189982.5 Ops/sec
Cash (.id) 1295702.0 Ops/sec
jQuery + getElementsByClassName 819423.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