Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36
Chrome 84
Mac OS X 10.14.6
Desktop
4 years ago
Test name Executions per second
getElementById 3345639.0 Ops/sec
jQuery (tag.id) 411087.7 Ops/sec
jQuery (tag#id) 380378.7 Ops/sec
jQuery (.id) 560924.8 Ops/sec
jQuery (#id) 1752483.2 Ops/sec
Cash + getElementsByClassName 1016628.4 Ops/sec
Cash + getElementById 1292313.2 Ops/sec
Cash (tag.id) 534785.2 Ops/sec
jQuery + getElementById 1385448.4 Ops/sec
Cash (tag#id) 481916.2 Ops/sec
Cash (#id) 1941565.4 Ops/sec
querySelectorAll (.id) 1492447.1 Ops/sec
querySelectorAll (#id) 1077066.5 Ops/sec
querySelector (.id) 3445118.8 Ops/sec
querySelector (#id) 2063664.1 Ops/sec
getElementsByTagName 2749603.0 Ops/sec
getElementsByClassName 2280688.8 Ops/sec
Cash (.id) 663728.9 Ops/sec
jQuery + getElementsByClassName 538399.9 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