Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36 OPR/41.0.2353.69
Opera 41
Linux
Other
7 years ago
Test name Executions per second
getElementById() 1625375.8 Ops/sec
getElementsByClassName() 1227712.1 Ops/sec
getElementsByTagName() 1415487.6 Ops/sec
querySelector(#id) 1379984.6 Ops/sec
querySelector(.id) 361395.3 Ops/sec
querySelectorAll(#id) 690352.2 Ops/sec
querySelectorAll(.id) 43782.1 Ops/sec
jQuery(#id) 666066.1 Ops/sec
jQuery(.id) 325741.5 Ops/sec
jQuery(tag#id) 220213.8 Ops/sec
jQuery(tag.id) 35422.4 Ops/sec
jQuery + getElementById 843981.1 Ops/sec
jQuery + getElementsByClassName 218747.3 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