Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Chrome 85
Mac OS X 10.15.1
Desktop
4 years ago
Test name Executions per second
getElementById 4113852.2 Ops/sec
jQuery (tag.id) 459649.5 Ops/sec
jQuery (tag#id) 438483.4 Ops/sec
jQuery (.id) 605840.1 Ops/sec
jQuery (#id) 1783635.4 Ops/sec
Cash + getElementsByClassName 1127199.1 Ops/sec
Cash + getElementById 1433596.6 Ops/sec
Cash (tag.id) 628899.2 Ops/sec
jQuery + getElementById 1463336.4 Ops/sec
Cash (tag#id) 552522.6 Ops/sec
Cash (#id) 2156110.8 Ops/sec
querySelectorAll (.id) 2166560.8 Ops/sec
querySelectorAll (#id) 1386454.6 Ops/sec
querySelector (.id) 4058753.8 Ops/sec
querySelector (#id) 2370971.2 Ops/sec
getElementsByTagName 3321184.2 Ops/sec
getElementsByClassName 2694957.0 Ops/sec
Cash (.id) 776301.0 Ops/sec
jQuery + getElementsByClassName 620663.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