Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36
Chrome 86
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3308972.5 Ops/sec
jQuery (tag.id) 455536.9 Ops/sec
jQuery (tag#id) 439030.9 Ops/sec
jQuery (.id) 596702.9 Ops/sec
jQuery (#id) 1848999.6 Ops/sec
Cash + getElementsByClassName 952239.0 Ops/sec
Cash + getElementById 1270567.5 Ops/sec
Cash (tag.id) 550948.0 Ops/sec
jQuery + getElementById 1343063.8 Ops/sec
Cash (tag#id) 477472.8 Ops/sec
Cash (#id) 2072963.0 Ops/sec
querySelectorAll (.id) 1847040.9 Ops/sec
querySelectorAll (#id) 1193281.4 Ops/sec
querySelector (.id) 3200425.8 Ops/sec
querySelector (#id) 1995930.6 Ops/sec
getElementsByTagName 2717651.0 Ops/sec
getElementsByClassName 2158843.2 Ops/sec
Cash (.id) 669363.0 Ops/sec
jQuery + getElementsByClassName 562863.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


;