Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
Firefox 78
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 4122307.2 Ops/sec
jQuery (tag.id) 646238.8 Ops/sec
jQuery (tag#id) 600440.8 Ops/sec
jQuery (.id) 861389.9 Ops/sec
jQuery (#id) 5522428.5 Ops/sec
Cash + getElementsByClassName 1721361.6 Ops/sec
Cash + getElementById 2890737.2 Ops/sec
Cash (tag.id) 1210659.0 Ops/sec
jQuery + getElementById 2887290.2 Ops/sec
Cash (tag#id) 1041847.2 Ops/sec
Cash (#id) 6013099.0 Ops/sec
querySelectorAll (.id) 1291642.2 Ops/sec
querySelectorAll (#id) 1246220.4 Ops/sec
querySelector (.id) 3169130.8 Ops/sec
querySelector (#id) 3167923.8 Ops/sec
getElementsByTagName 3281574.0 Ops/sec
getElementsByClassName 2665552.0 Ops/sec
Cash (.id) 1947045.0 Ops/sec
jQuery + getElementsByClassName 966343.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