Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.80 Safari/537.36
Chrome 86
Mac OS X 11.0.0
Desktop
4 years ago
Test name Executions per second
getElementById 3286032.0 Ops/sec
jQuery (tag.id) 409152.3 Ops/sec
jQuery (tag#id) 384149.4 Ops/sec
jQuery (.id) 591440.6 Ops/sec
jQuery (#id) 1533252.6 Ops/sec
Cash + getElementsByClassName 1021402.4 Ops/sec
Cash + getElementById 1315020.1 Ops/sec
Cash (tag.id) 552552.6 Ops/sec
jQuery + getElementById 1373206.6 Ops/sec
Cash (tag#id) 483068.2 Ops/sec
Cash (#id) 1904088.9 Ops/sec
querySelectorAll (.id) 1640851.5 Ops/sec
querySelectorAll (#id) 1123118.0 Ops/sec
querySelector (.id) 3485669.8 Ops/sec
querySelector (#id) 2081980.0 Ops/sec
getElementsByTagName 2760735.8 Ops/sec
getElementsByClassName 2180084.8 Ops/sec
Cash (.id) 711574.6 Ops/sec
jQuery + getElementsByClassName 587917.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