Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Chrome 80
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2592341.5 Ops/sec
jQuery (tag.id) 292528.5 Ops/sec
jQuery (tag#id) 277104.6 Ops/sec
jQuery (.id) 433174.2 Ops/sec
jQuery (#id) 1337712.2 Ops/sec
Cash + getElementsByClassName 707945.4 Ops/sec
Cash + getElementById 943254.6 Ops/sec
Cash (tag.id) 397908.2 Ops/sec
jQuery + getElementById 1086179.1 Ops/sec
Cash (tag#id) 365887.6 Ops/sec
Cash (#id) 1488638.0 Ops/sec
querySelectorAll (.id) 1222360.6 Ops/sec
querySelectorAll (#id) 801613.8 Ops/sec
querySelector (.id) 2203747.2 Ops/sec
querySelector (#id) 1413669.4 Ops/sec
getElementsByTagName 1941899.4 Ops/sec
getElementsByClassName 1572847.2 Ops/sec
Cash (.id) 484492.8 Ops/sec
jQuery + getElementsByClassName 422888.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


;