Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Chrome 80
Mac OS X 10.14.6
Desktop
4 years ago
Test name Executions per second
getElementById 2531739.2 Ops/sec
jQuery (tag.id) 330663.8 Ops/sec
jQuery (tag#id) 309633.8 Ops/sec
jQuery (.id) 441354.2 Ops/sec
jQuery (#id) 1419737.4 Ops/sec
Cash + getElementsByClassName 785660.5 Ops/sec
Cash + getElementById 1015710.9 Ops/sec
Cash (tag.id) 392091.7 Ops/sec
jQuery + getElementById 1137026.8 Ops/sec
Cash (tag#id) 354163.8 Ops/sec
Cash (#id) 1581412.2 Ops/sec
querySelectorAll (.id) 1234192.4 Ops/sec
querySelectorAll (#id) 827281.8 Ops/sec
querySelector (.id) 2495905.0 Ops/sec
querySelector (#id) 1494346.8 Ops/sec
getElementsByTagName 2123765.2 Ops/sec
getElementsByClassName 1754961.1 Ops/sec
Cash (.id) 516359.5 Ops/sec
jQuery + getElementsByClassName 444575.4 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