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 3367785.0 Ops/sec
jQuery (tag.id) 557658.6 Ops/sec
jQuery (tag#id) 520488.0 Ops/sec
jQuery (.id) 834252.1 Ops/sec
jQuery (#id) 1802915.0 Ops/sec
Cash + getElementsByClassName 883933.4 Ops/sec
Cash + getElementById 1381583.0 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.0 Ops/sec
querySelectorAll (.id) 1366361.0 Ops/sec
querySelectorAll (#id) 1132394.0 Ops/sec
querySelector (.id) 2745117.0 Ops/sec
querySelector (#id) 1984039.0 Ops/sec
getElementsByTagName 2894687.0 Ops/sec
getElementsByClassName 1870756.0 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