Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0
Firefox 78
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 3439137.0 Ops/sec
jQuery (tag.id) 561013.1 Ops/sec
jQuery (tag#id) 532328.3 Ops/sec
jQuery (.id) 863938.3 Ops/sec
jQuery (#id) 5091717.5 Ops/sec
Cash + getElementsByClassName 1449913.0 Ops/sec
Cash + getElementById 2605228.8 Ops/sec
Cash (tag.id) 1097763.1 Ops/sec
jQuery + getElementById 2808046.5 Ops/sec
Cash (tag#id) 1002756.1 Ops/sec
Cash (#id) 6067672.5 Ops/sec
querySelectorAll (.id) 1226734.1 Ops/sec
querySelectorAll (#id) 1106930.1 Ops/sec
querySelector (.id) 2797799.0 Ops/sec
querySelector (#id) 2824664.0 Ops/sec
getElementsByTagName 2966460.5 Ops/sec
getElementsByClassName 2346510.2 Ops/sec
Cash (.id) 1948562.2 Ops/sec
jQuery + getElementsByClassName 778810.3 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