Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
Chrome 89
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
getElementById 3199680.5 Ops/sec
jQuery (tag.id) 541611.6 Ops/sec
jQuery (tag#id) 501441.0 Ops/sec
jQuery (.id) 827344.9 Ops/sec
jQuery (#id) 1676725.6 Ops/sec
Cash + getElementsByClassName 860489.2 Ops/sec
Cash + getElementById 1266951.8 Ops/sec
Cash (tag.id) 809646.5 Ops/sec
jQuery + getElementById 1361460.5 Ops/sec
Cash (tag#id) 700501.2 Ops/sec
Cash (#id) 1732232.9 Ops/sec
querySelectorAll (.id) 1256813.8 Ops/sec
querySelectorAll (#id) 940999.8 Ops/sec
querySelector (.id) 2570512.5 Ops/sec
querySelector (#id) 1953608.2 Ops/sec
getElementsByTagName 2771778.8 Ops/sec
getElementsByClassName 1720016.6 Ops/sec
Cash (.id) 963630.9 Ops/sec
jQuery + getElementsByClassName 481604.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


;