Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 1890187.5 Ops/sec
jQuery (tag.id) 256856.0 Ops/sec
jQuery (tag#id) 239134.8 Ops/sec
jQuery (.id) 314265.9 Ops/sec
jQuery (#id) 858801.2 Ops/sec
Cash + getElementsByClassName 490480.9 Ops/sec
Cash + getElementById 672381.0 Ops/sec
Cash (tag.id) 323676.5 Ops/sec
jQuery + getElementById 699837.4 Ops/sec
Cash (tag#id) 297912.6 Ops/sec
Cash (#id) 967779.6 Ops/sec
querySelectorAll (.id) 921240.9 Ops/sec
querySelectorAll (#id) 607650.7 Ops/sec
querySelector (.id) 2148072.5 Ops/sec
querySelector (#id) 1142721.2 Ops/sec
getElementsByTagName 1460877.4 Ops/sec
getElementsByClassName 1198849.5 Ops/sec
Cash (.id) 371312.2 Ops/sec
jQuery + getElementsByClassName 309411.6 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