Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2009310.5 Ops/sec
jQuery (tag.id) 163251.2 Ops/sec
jQuery (tag#id) 160756.4 Ops/sec
jQuery (.id) 206637.3 Ops/sec
jQuery (#id) 911632.9 Ops/sec
Cash + getElementsByClassName 496443.3 Ops/sec
Cash + getElementById 792198.0 Ops/sec
Cash (tag.id) 251245.9 Ops/sec
jQuery + getElementById 810708.2 Ops/sec
Cash (tag#id) 230829.4 Ops/sec
Cash (#id) 1125988.8 Ops/sec
querySelectorAll (.id) 1102055.6 Ops/sec
querySelectorAll (#id) 646877.0 Ops/sec
querySelector (.id) 2396675.2 Ops/sec
querySelector (#id) 1330797.6 Ops/sec
getElementsByTagName 1351244.9 Ops/sec
getElementsByClassName 1312557.8 Ops/sec
Cash (.id) 274663.4 Ops/sec
jQuery + getElementsByClassName 228944.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