Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Chrome 87
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 2254209.2 Ops/sec
jQuery (tag.id) 316208.3 Ops/sec
jQuery (tag#id) 307733.8 Ops/sec
jQuery (.id) 454165.3 Ops/sec
jQuery (#id) 1348478.5 Ops/sec
Cash + getElementsByClassName 769981.7 Ops/sec
Cash + getElementById 1050702.4 Ops/sec
Cash (tag.id) 439705.3 Ops/sec
jQuery + getElementById 1045340.4 Ops/sec
Cash (tag#id) 390663.7 Ops/sec
Cash (#id) 1468496.9 Ops/sec
querySelectorAll (.id) 1323065.8 Ops/sec
querySelectorAll (#id) 932653.2 Ops/sec
querySelector (.id) 2461917.2 Ops/sec
querySelector (#id) 1544735.6 Ops/sec
getElementsByTagName 1907246.2 Ops/sec
getElementsByClassName 1650612.4 Ops/sec
Cash (.id) 570197.4 Ops/sec
jQuery + getElementsByClassName 462687.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