Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36
Chrome 84
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 990662.2 Ops/sec
jQuery (tag.id) 142868.1 Ops/sec
jQuery (tag#id) 138122.7 Ops/sec
jQuery (.id) 205721.0 Ops/sec
jQuery (#id) 514528.3 Ops/sec
Cash + getElementsByClassName 243327.3 Ops/sec
Cash + getElementById 328277.5 Ops/sec
Cash (tag.id) 207436.7 Ops/sec
jQuery + getElementById 488812.3 Ops/sec
Cash (tag#id) 137937.4 Ops/sec
Cash (#id) 540812.4 Ops/sec
querySelectorAll (.id) 549066.9 Ops/sec
querySelectorAll (#id) 365799.7 Ops/sec
querySelector (.id) 1308638.6 Ops/sec
querySelector (#id) 760519.1 Ops/sec
getElementsByTagName 1013523.0 Ops/sec
getElementsByClassName 683458.0 Ops/sec
Cash (.id) 195232.6 Ops/sec
jQuery + getElementsByClassName 197267.6 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