Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36
Chrome 89
Mac OS X 11.2.3
Desktop
3 years ago
Test name Executions per second
getElementById 2651311.0 Ops/sec
jQuery (tag.id) 438551.5 Ops/sec
jQuery (tag#id) 417840.6 Ops/sec
jQuery (.id) 696339.6 Ops/sec
jQuery (#id) 1396097.1 Ops/sec
Cash + getElementsByClassName 701729.3 Ops/sec
Cash + getElementById 983669.8 Ops/sec
Cash (tag.id) 666250.2 Ops/sec
jQuery + getElementById 1178389.6 Ops/sec
Cash (tag#id) 569668.6 Ops/sec
Cash (#id) 1565926.2 Ops/sec
querySelectorAll (.id) 1046202.9 Ops/sec
querySelectorAll (#id) 854801.8 Ops/sec
querySelector (.id) 2130523.2 Ops/sec
querySelector (#id) 1502146.6 Ops/sec
getElementsByTagName 2182650.8 Ops/sec
getElementsByClassName 1314300.6 Ops/sec
Cash (.id) 735849.8 Ops/sec
jQuery + getElementsByClassName 429096.2 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