Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36
Chrome 74
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 2366351.2 Ops/sec
jQuery (tag.id) 283220.2 Ops/sec
jQuery (tag#id) 272409.2 Ops/sec
jQuery (.id) 447153.1 Ops/sec
jQuery (#id) 877446.2 Ops/sec
Cash + getElementsByClassName 733383.9 Ops/sec
Cash + getElementById 1027735.2 Ops/sec
Cash (tag.id) 400806.9 Ops/sec
jQuery + getElementById 1071244.0 Ops/sec
Cash (tag#id) 348867.3 Ops/sec
Cash (#id) 958945.8 Ops/sec
querySelectorAll (.id) 808515.0 Ops/sec
querySelectorAll (#id) 646448.7 Ops/sec
querySelector (.id) 2023462.0 Ops/sec
querySelector (#id) 1543436.8 Ops/sec
getElementsByTagName 1985965.0 Ops/sec
getElementsByClassName 1701193.5 Ops/sec
Cash (.id) 540193.2 Ops/sec
jQuery + getElementsByClassName 414129.1 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