Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36
Chrome 87
Linux
Desktop
3 years ago
Test name Executions per second
getElementById 2190720.8 Ops/sec
jQuery (tag.id) 170032.2 Ops/sec
jQuery (tag#id) 169142.9 Ops/sec
jQuery (.id) 236835.7 Ops/sec
jQuery (#id) 912004.8 Ops/sec
Cash + getElementsByClassName 500481.6 Ops/sec
Cash + getElementById 780419.9 Ops/sec
Cash (tag.id) 255191.0 Ops/sec
jQuery + getElementById 919080.1 Ops/sec
Cash (tag#id) 266586.5 Ops/sec
Cash (#id) 1266027.6 Ops/sec
querySelectorAll (.id) 956122.0 Ops/sec
querySelectorAll (#id) 644631.8 Ops/sec
querySelector (.id) 2594406.5 Ops/sec
querySelector (#id) 1200964.0 Ops/sec
getElementsByTagName 1885002.2 Ops/sec
getElementsByClassName 1608980.5 Ops/sec
Cash (.id) 318893.3 Ops/sec
jQuery + getElementsByClassName 285751.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