Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36
Chrome 88
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 2433311.2 Ops/sec
jQuery (tag.id) 362675.4 Ops/sec
jQuery (tag#id) 332266.5 Ops/sec
jQuery (.id) 455824.0 Ops/sec
jQuery (#id) 1250713.0 Ops/sec
Cash + getElementsByClassName 749738.6 Ops/sec
Cash + getElementById 977326.2 Ops/sec
Cash (tag.id) 456271.6 Ops/sec
jQuery + getElementById 1009378.2 Ops/sec
Cash (tag#id) 406822.5 Ops/sec
Cash (#id) 1375218.2 Ops/sec
querySelectorAll (.id) 1459435.5 Ops/sec
querySelectorAll (#id) 903006.9 Ops/sec
querySelector (.id) 2796484.5 Ops/sec
querySelector (#id) 1439950.4 Ops/sec
getElementsByTagName 2157189.2 Ops/sec
getElementsByClassName 1813075.2 Ops/sec
Cash (.id) 530557.7 Ops/sec
jQuery + getElementsByClassName 423485.8 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