Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0
Firefox 84
Linux
Desktop
3 years ago
Test name Executions per second
getElementById 5532680.0 Ops/sec
jQuery (tag.id) 739472.3 Ops/sec
jQuery (tag#id) 702417.4 Ops/sec
jQuery (.id) 1223597.2 Ops/sec
jQuery (#id) 5372064.5 Ops/sec
Cash + getElementsByClassName 2071497.4 Ops/sec
Cash + getElementById 3213597.5 Ops/sec
Cash (tag.id) 1141019.4 Ops/sec
jQuery + getElementById 3447826.0 Ops/sec
Cash (tag#id) 1065192.8 Ops/sec
Cash (#id) 5003450.0 Ops/sec
querySelectorAll (.id) 1637422.5 Ops/sec
querySelectorAll (#id) 1447066.6 Ops/sec
querySelector (.id) 3991548.5 Ops/sec
querySelector (#id) 4069556.5 Ops/sec
getElementsByTagName 4236567.0 Ops/sec
getElementsByClassName 3095329.2 Ops/sec
Cash (.id) 1944210.6 Ops/sec
jQuery + getElementsByClassName 968687.5 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