Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
Firefox 74
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2379253.8 Ops/sec
jQuery (tag.id) 204126.9 Ops/sec
jQuery (tag#id) 189159.1 Ops/sec
jQuery (.id) 365578.9 Ops/sec
jQuery (#id) 2664607.5 Ops/sec
Cash + getElementsByClassName 818037.2 Ops/sec
Cash + getElementById 1624063.2 Ops/sec
Cash (tag.id) 501322.3 Ops/sec
jQuery + getElementById 1614587.9 Ops/sec
Cash (tag#id) 453600.9 Ops/sec
Cash (#id) 3244873.8 Ops/sec
querySelectorAll (.id) 698407.9 Ops/sec
querySelectorAll (#id) 589753.7 Ops/sec
querySelector (.id) 1799849.6 Ops/sec
querySelector (#id) 1720804.9 Ops/sec
getElementsByTagName 1905685.8 Ops/sec
getElementsByClassName 1432346.4 Ops/sec
Cash (.id) 1045370.9 Ops/sec
jQuery + getElementsByClassName 399460.2 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