Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36
Chrome 86
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2484349.5 Ops/sec
jQuery (tag.id) 375932.5 Ops/sec
jQuery (tag#id) 332311.7 Ops/sec
jQuery (.id) 482788.1 Ops/sec
jQuery (#id) 1311865.2 Ops/sec
Cash + getElementsByClassName 815432.2 Ops/sec
Cash + getElementById 1096556.5 Ops/sec
Cash (tag.id) 442913.5 Ops/sec
jQuery + getElementById 1035365.1 Ops/sec
Cash (tag#id) 362584.9 Ops/sec
Cash (#id) 1599722.1 Ops/sec
querySelectorAll (.id) 1271845.1 Ops/sec
querySelectorAll (#id) 894557.5 Ops/sec
querySelector (.id) 2452498.2 Ops/sec
querySelector (#id) 1609037.5 Ops/sec
getElementsByTagName 2072583.0 Ops/sec
getElementsByClassName 1661224.0 Ops/sec
Cash (.id) 530738.2 Ops/sec
jQuery + getElementsByClassName 464740.2 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


;