Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36
Chrome 89
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 3367784.8 Ops/sec
jQuery (tag.id) 557658.6 Ops/sec
jQuery (tag#id) 520488.0 Ops/sec
jQuery (.id) 834252.1 Ops/sec
jQuery (#id) 1802914.9 Ops/sec
Cash + getElementsByClassName 883933.4 Ops/sec
Cash + getElementById 1381582.5 Ops/sec
Cash (tag.id) 806534.9 Ops/sec
jQuery + getElementById 1458280.0 Ops/sec
Cash (tag#id) 720429.0 Ops/sec
Cash (#id) 2102424.2 Ops/sec
querySelectorAll (.id) 1366360.5 Ops/sec
querySelectorAll (#id) 1132393.6 Ops/sec
querySelector (.id) 2745116.8 Ops/sec
querySelector (#id) 1984039.1 Ops/sec
getElementsByTagName 2894687.0 Ops/sec
getElementsByClassName 1870755.6 Ops/sec
Cash (.id) 987579.7 Ops/sec
jQuery + getElementsByClassName 560624.7 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