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 3133757.5 Ops/sec
jQuery (tag.id) 454267.7 Ops/sec
jQuery (tag#id) 403127.7 Ops/sec
jQuery (.id) 562080.0 Ops/sec
jQuery (#id) 1595564.0 Ops/sec
Cash + getElementsByClassName 917824.1 Ops/sec
Cash + getElementById 1255859.9 Ops/sec
Cash (tag.id) 556441.8 Ops/sec
jQuery + getElementById 1341091.9 Ops/sec
Cash (tag#id) 491127.7 Ops/sec
Cash (#id) 1935198.1 Ops/sec
querySelectorAll (.id) 1741074.0 Ops/sec
querySelectorAll (#id) 1177059.0 Ops/sec
querySelector (.id) 3095646.5 Ops/sec
querySelector (#id) 1873275.9 Ops/sec
getElementsByTagName 2571282.5 Ops/sec
getElementsByClassName 2117433.2 Ops/sec
Cash (.id) 676710.0 Ops/sec
jQuery + getElementsByClassName 571242.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


;