Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36
Chrome 81
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 869400.4 Ops/sec
jQuery (tag.id) 52601.5 Ops/sec
jQuery (tag#id) 50097.9 Ops/sec
jQuery (.id) 78447.0 Ops/sec
jQuery (#id) 253529.9 Ops/sec
Cash + getElementsByClassName 198042.2 Ops/sec
Cash + getElementById 250305.0 Ops/sec
Cash (tag.id) 86626.0 Ops/sec
jQuery + getElementById 277335.2 Ops/sec
Cash (tag#id) 88007.5 Ops/sec
Cash (#id) 387428.2 Ops/sec
querySelectorAll (.id) 334279.8 Ops/sec
querySelectorAll (#id) 177594.9 Ops/sec
querySelector (.id) 868992.4 Ops/sec
querySelector (#id) 423148.6 Ops/sec
getElementsByTagName 700391.1 Ops/sec
getElementsByClassName 474267.0 Ops/sec
Cash (.id) 112443.6 Ops/sec
jQuery + getElementsByClassName 93156.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


;