Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36 Edg/89.0.774.68
Chrome 89
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 1770305.2 Ops/sec
jQuery (tag.id) 448956.2 Ops/sec
jQuery (tag#id) 372010.5 Ops/sec
jQuery (.id) 554625.8 Ops/sec
jQuery (#id) 1348488.1 Ops/sec
Cash + getElementsByClassName 732829.6 Ops/sec
Cash + getElementById 1030993.5 Ops/sec
Cash (tag.id) 798698.3 Ops/sec
jQuery + getElementById 1216475.6 Ops/sec
Cash (tag#id) 624250.8 Ops/sec
Cash (#id) 1573146.8 Ops/sec
querySelectorAll (.id) 1306813.8 Ops/sec
querySelectorAll (#id) 888226.6 Ops/sec
querySelector (.id) 1117202.1 Ops/sec
querySelector (#id) 1040840.2 Ops/sec
getElementsByTagName 1834651.5 Ops/sec
getElementsByClassName 850550.1 Ops/sec
Cash (.id) 803821.0 Ops/sec
jQuery + getElementsByClassName 476326.1 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