Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36 Edg/94.0.992.31
Chrome 94
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 3931588.0 Ops/sec
jQuery (tag.id) 621151.1 Ops/sec
jQuery (tag#id) 564182.0 Ops/sec
jQuery (.id) 850517.9 Ops/sec
jQuery (#id) 2121672.2 Ops/sec
Cash + getElementsByClassName 1232198.8 Ops/sec
Cash + getElementById 1598723.6 Ops/sec
Cash (tag.id) 908535.4 Ops/sec
jQuery + getElementById 1753550.4 Ops/sec
Cash (tag#id) 754094.3 Ops/sec
Cash (#id) 2474565.0 Ops/sec
querySelectorAll (.id) 2078832.0 Ops/sec
querySelectorAll (#id) 1299005.0 Ops/sec
querySelector (.id) 4092093.2 Ops/sec
querySelector (#id) 2213062.5 Ops/sec
getElementsByTagName 3513718.8 Ops/sec
getElementsByClassName 2823619.8 Ops/sec
Cash (.id) 1093383.5 Ops/sec
jQuery + getElementsByClassName 701009.6 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


;