Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36
Chrome 87
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2601937.0 Ops/sec
jQuery (tag.id) 365808.9 Ops/sec
jQuery (tag#id) 332841.1 Ops/sec
jQuery (.id) 444197.2 Ops/sec
jQuery (#id) 1423032.9 Ops/sec
Cash + getElementsByClassName 829256.5 Ops/sec
Cash + getElementById 1080200.1 Ops/sec
Cash (tag.id) 441301.4 Ops/sec
jQuery + getElementById 1125364.8 Ops/sec
Cash (tag#id) 408582.4 Ops/sec
Cash (#id) 1644879.5 Ops/sec
querySelectorAll (.id) 1519590.2 Ops/sec
querySelectorAll (#id) 1051362.1 Ops/sec
querySelector (.id) 2642474.2 Ops/sec
querySelector (#id) 1669004.1 Ops/sec
getElementsByTagName 2189096.8 Ops/sec
getElementsByClassName 1746961.6 Ops/sec
Cash (.id) 539548.9 Ops/sec
jQuery + getElementsByClassName 509064.8 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