Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36
Chrome 86
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3073564.2 Ops/sec
jQuery (tag.id) 373218.0 Ops/sec
jQuery (tag#id) 356244.1 Ops/sec
jQuery (.id) 530509.2 Ops/sec
jQuery (#id) 1638661.1 Ops/sec
Cash + getElementsByClassName 882928.9 Ops/sec
Cash + getElementById 1220047.9 Ops/sec
Cash (tag.id) 440429.4 Ops/sec
jQuery + getElementById 1304323.4 Ops/sec
Cash (tag#id) 400929.7 Ops/sec
Cash (#id) 1575468.4 Ops/sec
querySelectorAll (.id) 1460781.1 Ops/sec
querySelectorAll (#id) 1031714.7 Ops/sec
querySelector (.id) 2955041.2 Ops/sec
querySelector (#id) 1805010.5 Ops/sec
getElementsByTagName 2524136.8 Ops/sec
getElementsByClassName 1986267.6 Ops/sec
Cash (.id) 583052.1 Ops/sec
jQuery + getElementsByClassName 544375.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