Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0
Firefox 82
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2768202.2 Ops/sec
jQuery (tag.id) 415978.2 Ops/sec
jQuery (tag#id) 399184.2 Ops/sec
jQuery (.id) 648665.8 Ops/sec
jQuery (#id) 4147418.2 Ops/sec
Cash + getElementsByClassName 1130687.4 Ops/sec
Cash + getElementById 1968268.1 Ops/sec
Cash (tag.id) 618670.8 Ops/sec
jQuery + getElementById 2232033.2 Ops/sec
Cash (tag#id) 677227.8 Ops/sec
Cash (#id) 4613577.5 Ops/sec
querySelectorAll (.id) 943489.2 Ops/sec
querySelectorAll (#id) 784247.4 Ops/sec
querySelector (.id) 2283621.0 Ops/sec
querySelector (#id) 2201403.0 Ops/sec
getElementsByTagName 2140359.0 Ops/sec
getElementsByClassName 1735674.9 Ops/sec
Cash (.id) 1292981.9 Ops/sec
jQuery + getElementsByClassName 604304.6 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