Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0
Firefox 76
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3683436.0 Ops/sec
jQuery (tag.id) 537079.8 Ops/sec
jQuery (tag#id) 511012.2 Ops/sec
jQuery (.id) 883276.3 Ops/sec
jQuery (#id) 4515073.5 Ops/sec
Cash + getElementsByClassName 1381120.9 Ops/sec
Cash + getElementById 2217177.8 Ops/sec
Cash (tag.id) 964374.6 Ops/sec
jQuery + getElementById 2517391.0 Ops/sec
Cash (tag#id) 849227.7 Ops/sec
Cash (#id) 4992780.0 Ops/sec
querySelectorAll (.id) 1243568.0 Ops/sec
querySelectorAll (#id) 1144055.4 Ops/sec
querySelector (.id) 2851923.5 Ops/sec
querySelector (#id) 2847452.2 Ops/sec
getElementsByTagName 2921562.5 Ops/sec
getElementsByClassName 2341210.0 Ops/sec
Cash (.id) 1677899.4 Ops/sec
jQuery + getElementsByClassName 774912.5 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