Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:68.9) Gecko/20100101 Goanna/4.6 Firefox/68.9 PaleMoon/28.14.2
Pale Moon (Firefox Variant) 28
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 10331024.0 Ops/sec
jQuery (tag.id) 220453.7 Ops/sec
jQuery (tag#id) 225497.8 Ops/sec
jQuery (.id) 389932.5 Ops/sec
jQuery (#id) 4412510.0 Ops/sec
Cash + getElementsByClassName 1331540.0 Ops/sec
Cash + getElementById 1955931.4 Ops/sec
Cash (tag.id) 599918.1 Ops/sec
jQuery + getElementById 5910503.0 Ops/sec
Cash (tag#id) 629729.9 Ops/sec
Cash (#id) 2316067.8 Ops/sec
querySelectorAll (.id) 1045128.2 Ops/sec
querySelectorAll (#id) 1025741.0 Ops/sec
querySelector (.id) 3570245.0 Ops/sec
querySelector (#id) 3648654.8 Ops/sec
getElementsByTagName 6241349.5 Ops/sec
getElementsByClassName 3626645.0 Ops/sec
Cash (.id) 1120911.2 Ops/sec
jQuery + getElementsByClassName 663494.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