Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Chrome 87
Windows 7
Desktop
3 years ago
Test name Executions per second
getElementById 1883229.2 Ops/sec
jQuery (tag.id) 146566.7 Ops/sec
jQuery (tag#id) 146770.7 Ops/sec
jQuery (.id) 212131.6 Ops/sec
jQuery (#id) 846394.0 Ops/sec
Cash + getElementsByClassName 470065.2 Ops/sec
Cash + getElementById 743753.8 Ops/sec
Cash (tag.id) 232297.3 Ops/sec
jQuery + getElementById 745744.3 Ops/sec
Cash (tag#id) 225736.7 Ops/sec
Cash (#id) 1095343.2 Ops/sec
querySelectorAll (.id) 917507.6 Ops/sec
querySelectorAll (#id) 622361.2 Ops/sec
querySelector (.id) 1938970.0 Ops/sec
querySelector (#id) 1102151.4 Ops/sec
getElementsByTagName 1599004.1 Ops/sec
getElementsByClassName 1313260.1 Ops/sec
Cash (.id) 285156.7 Ops/sec
jQuery + getElementsByClassName 258996.5 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


;