Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36 Edg/94.0.992.31
Chrome 94
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 3919245.5 Ops/sec
jQuery (tag.id) 551489.9 Ops/sec
jQuery (tag#id) 513348.2 Ops/sec
jQuery (.id) 755304.3 Ops/sec
jQuery (#id) 2021269.1 Ops/sec
Cash + getElementsByClassName 1149216.2 Ops/sec
Cash + getElementById 1501226.8 Ops/sec
Cash (tag.id) 823884.0 Ops/sec
jQuery + getElementById 1555712.9 Ops/sec
Cash (tag#id) 690566.1 Ops/sec
Cash (#id) 2266582.8 Ops/sec
querySelectorAll (.id) 1996988.6 Ops/sec
querySelectorAll (#id) 1152494.8 Ops/sec
querySelector (.id) 3829652.2 Ops/sec
querySelector (#id) 2126263.8 Ops/sec
getElementsByTagName 3297809.2 Ops/sec
getElementsByClassName 2734305.8 Ops/sec
Cash (.id) 982901.5 Ops/sec
jQuery + getElementsByClassName 668948.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


;