Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36
Chrome 86
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 1145721.2 Ops/sec
jQuery (tag.id) 242484.0 Ops/sec
jQuery (tag#id) 222065.4 Ops/sec
jQuery (.id) 312680.5 Ops/sec
jQuery (#id) 1040634.2 Ops/sec
Cash + getElementsByClassName 416138.0 Ops/sec
Cash + getElementById 698923.4 Ops/sec
Cash (tag.id) 263459.0 Ops/sec
jQuery + getElementById 733189.5 Ops/sec
Cash (tag#id) 258991.0 Ops/sec
Cash (#id) 947104.4 Ops/sec
querySelectorAll (.id) 737240.9 Ops/sec
querySelectorAll (#id) 535143.6 Ops/sec
querySelector (.id) 1617808.8 Ops/sec
querySelector (#id) 992507.1 Ops/sec
getElementsByTagName 1484600.0 Ops/sec
getElementsByClassName 927468.1 Ops/sec
Cash (.id) 286150.4 Ops/sec
jQuery + getElementsByClassName 295965.2 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