Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36
Chrome 84
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 1017479.1 Ops/sec
jQuery (tag.id) 32277.0 Ops/sec
jQuery (tag#id) 60361.7 Ops/sec
jQuery (.id) 133576.7 Ops/sec
jQuery (#id) 603738.1 Ops/sec
Cash + getElementsByClassName 295009.1 Ops/sec
Cash + getElementById 644013.2 Ops/sec
Cash (tag.id) 141625.2 Ops/sec
jQuery + getElementById 141563.5 Ops/sec
Cash (tag#id) 220223.5 Ops/sec
Cash (#id) 484389.9 Ops/sec
querySelectorAll (.id) 433691.9 Ops/sec
querySelectorAll (#id) 70619.2 Ops/sec
querySelector (.id) 1495143.4 Ops/sec
querySelector (#id) 610585.9 Ops/sec
getElementsByTagName 237962.0 Ops/sec
getElementsByClassName 655017.4 Ops/sec
Cash (.id) 144883.9 Ops/sec
jQuery + getElementsByClassName 50061.4 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