Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:88.0) Gecko/20100101 Firefox/88.0
Firefox 88
Mac OS X 10.15
Desktop
3 years ago
Test name Executions per second
getElementById 7312304.5 Ops/sec
jQuery (tag.id) 1260743.5 Ops/sec
jQuery (tag#id) 1207781.4 Ops/sec
jQuery (.id) 1824107.5 Ops/sec
jQuery (#id) 7327339.5 Ops/sec
Cash + getElementsByClassName 2641154.8 Ops/sec
Cash + getElementById 4595525.5 Ops/sec
Cash (tag.id) 1768156.9 Ops/sec
jQuery + getElementById 4838934.5 Ops/sec
Cash (tag#id) 1644616.4 Ops/sec
Cash (#id) 6606653.0 Ops/sec
querySelectorAll (.id) 2538506.2 Ops/sec
querySelectorAll (#id) 2264800.0 Ops/sec
querySelector (.id) 5472596.0 Ops/sec
querySelector (#id) 5419202.5 Ops/sec
getElementsByTagName 5302993.5 Ops/sec
getElementsByClassName 3983291.5 Ops/sec
Cash (.id) 2541246.2 Ops/sec
jQuery + getElementsByClassName 1173575.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