Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
Chrome 84
Mac OS X 10.15.6
Desktop
4 years ago
Test name Executions per second
getElementById 2389515.2 Ops/sec
jQuery (tag.id) 244704.8 Ops/sec
jQuery (tag#id) 246363.7 Ops/sec
jQuery (.id) 307526.1 Ops/sec
jQuery (#id) 934454.1 Ops/sec
Cash + getElementsByClassName 586424.4 Ops/sec
Cash + getElementById 653196.8 Ops/sec
Cash (tag.id) 185463.2 Ops/sec
jQuery + getElementById 712989.4 Ops/sec
Cash (tag#id) 153725.1 Ops/sec
Cash (#id) 1318799.0 Ops/sec
querySelectorAll (.id) 911155.0 Ops/sec
querySelectorAll (#id) 818981.5 Ops/sec
querySelector (.id) 2681535.8 Ops/sec
querySelector (#id) 1550926.4 Ops/sec
getElementsByTagName 2108759.8 Ops/sec
getElementsByClassName 1700612.8 Ops/sec
Cash (.id) 319045.4 Ops/sec
jQuery + getElementsByClassName 394392.1 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