Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0
Firefox 81
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 4059194.2 Ops/sec
jQuery (tag.id) 615953.6 Ops/sec
jQuery (tag#id) 567669.9 Ops/sec
jQuery (.id) 940621.6 Ops/sec
jQuery (#id) 5513593.0 Ops/sec
Cash + getElementsByClassName 1568956.4 Ops/sec
Cash + getElementById 2892448.8 Ops/sec
Cash (tag.id) 1084215.1 Ops/sec
jQuery + getElementById 2938743.5 Ops/sec
Cash (tag#id) 1036070.6 Ops/sec
Cash (#id) 6256249.0 Ops/sec
querySelectorAll (.id) 1116872.6 Ops/sec
querySelectorAll (#id) 1134728.9 Ops/sec
querySelector (.id) 3165731.5 Ops/sec
querySelector (#id) 3189083.2 Ops/sec
getElementsByTagName 3235907.5 Ops/sec
getElementsByClassName 2468945.5 Ops/sec
Cash (.id) 1968329.8 Ops/sec
jQuery + getElementsByClassName 864577.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


;