Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0
Firefox 89
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 3598735.5 Ops/sec
jQuery (tag.id) 281998.0 Ops/sec
jQuery (tag#id) 263501.9 Ops/sec
jQuery (.id) 460092.4 Ops/sec
jQuery (#id) 3390921.2 Ops/sec
Cash + getElementsByClassName 1001048.5 Ops/sec
Cash + getElementById 2078450.1 Ops/sec
Cash (tag.id) 558442.4 Ops/sec
jQuery + getElementById 2217480.0 Ops/sec
Cash (tag#id) 517652.8 Ops/sec
Cash (#id) 3351994.2 Ops/sec
querySelectorAll (.id) 933041.2 Ops/sec
querySelectorAll (#id) 792214.4 Ops/sec
querySelector (.id) 2497442.5 Ops/sec
querySelector (#id) 2465100.8 Ops/sec
getElementsByTagName 2638187.2 Ops/sec
getElementsByClassName 1863159.4 Ops/sec
Cash (.id) 1099609.0 Ops/sec
jQuery + getElementsByClassName 394463.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