Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4130.0 Safari/537.36 Edg/84.0.502.0
Chrome 84
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2392887.2 Ops/sec
jQuery (tag.id) 364284.1 Ops/sec
jQuery (tag#id) 341564.5 Ops/sec
jQuery (.id) 467227.9 Ops/sec
jQuery (#id) 1355304.9 Ops/sec
Cash + getElementsByClassName 738841.1 Ops/sec
Cash + getElementById 959235.4 Ops/sec
Cash (tag.id) 434795.9 Ops/sec
jQuery + getElementById 1032219.4 Ops/sec
Cash (tag#id) 375176.1 Ops/sec
Cash (#id) 1486848.0 Ops/sec
querySelectorAll (.id) 1213909.0 Ops/sec
querySelectorAll (#id) 912118.4 Ops/sec
querySelector (.id) 2393286.5 Ops/sec
querySelector (#id) 1474561.0 Ops/sec
getElementsByTagName 1973734.4 Ops/sec
getElementsByClassName 1581092.8 Ops/sec
Cash (.id) 518344.4 Ops/sec
jQuery + getElementsByClassName 442126.0 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