Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
Chrome 88
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 885120.4 Ops/sec
jQuery (tag.id) 218722.6 Ops/sec
jQuery (tag#id) 292107.6 Ops/sec
jQuery (.id) 420379.5 Ops/sec
jQuery (#id) 1297545.8 Ops/sec
Cash + getElementsByClassName 673191.4 Ops/sec
Cash + getElementById 937537.4 Ops/sec
Cash (tag.id) 386372.4 Ops/sec
jQuery + getElementById 739730.1 Ops/sec
Cash (tag#id) 348552.1 Ops/sec
Cash (#id) 1219986.0 Ops/sec
querySelectorAll (.id) 872713.0 Ops/sec
querySelectorAll (#id) 333485.2 Ops/sec
querySelector (.id) 884542.8 Ops/sec
querySelector (#id) 491527.7 Ops/sec
getElementsByTagName 731668.1 Ops/sec
getElementsByClassName 521273.8 Ops/sec
Cash (.id) 500865.7 Ops/sec
jQuery + getElementsByClassName 399547.8 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