Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.108 Safari/537.36
Chrome 84
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 1279287.2 Ops/sec
jQuery (tag.id) 188398.2 Ops/sec
jQuery (tag#id) 176748.8 Ops/sec
jQuery (.id) 234607.0 Ops/sec
jQuery (#id) 779962.6 Ops/sec
Cash + getElementsByClassName 420529.8 Ops/sec
Cash + getElementById 589661.9 Ops/sec
Cash (tag.id) 257192.8 Ops/sec
jQuery + getElementById 609428.5 Ops/sec
Cash (tag#id) 229755.8 Ops/sec
Cash (#id) 827732.5 Ops/sec
querySelectorAll (.id) 712174.2 Ops/sec
querySelectorAll (#id) 473146.4 Ops/sec
querySelector (.id) 1302288.0 Ops/sec
querySelector (#id) 656901.6 Ops/sec
getElementsByTagName 1008435.8 Ops/sec
getElementsByClassName 880553.6 Ops/sec
Cash (.id) 317800.8 Ops/sec
jQuery + getElementsByClassName 238628.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