Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/79.0.3945.79 Chrome/79.0.3945.79 Safari/537.36
Chromium 79
Ubuntu
Desktop
4 years ago
Test name Executions per second
getElementById() 2806906.2 Ops/sec
getElementsByClassName() 1969023.9 Ops/sec
getElementsByTagName() 2181838.8 Ops/sec
querySelector(#id) 1645222.8 Ops/sec
querySelector(.id) 2137061.2 Ops/sec
querySelectorAll(#id) 902232.2 Ops/sec
querySelectorAll(.id) 1132484.4 Ops/sec
jQuery(#id) 851672.4 Ops/sec
jQuery(.id) 422426.5 Ops/sec
jQuery(tag#id) 295844.2 Ops/sec
jQuery(tag.id) 298669.8 Ops/sec
jQuery + getElementById 1116379.4 Ops/sec
jQuery + getElementsByClassName 400434.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


;