Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36
Chrome 88
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 2135836.2 Ops/sec
jQuery (tag.id) 330271.8 Ops/sec
jQuery (tag#id) 296790.3 Ops/sec
jQuery (.id) 417941.4 Ops/sec
jQuery (#id) 1201069.0 Ops/sec
Cash + getElementsByClassName 694165.8 Ops/sec
Cash + getElementById 942735.4 Ops/sec
Cash (tag.id) 368363.2 Ops/sec
jQuery + getElementById 982163.1 Ops/sec
Cash (tag#id) 335224.2 Ops/sec
Cash (#id) 1394529.4 Ops/sec
querySelectorAll (.id) 1284270.6 Ops/sec
querySelectorAll (#id) 871270.2 Ops/sec
querySelector (.id) 2423271.8 Ops/sec
querySelector (#id) 1345922.6 Ops/sec
getElementsByTagName 1988219.9 Ops/sec
getElementsByClassName 1553004.8 Ops/sec
Cash (.id) 474684.7 Ops/sec
jQuery + getElementsByClassName 421582.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