Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) snap Chromium/74.0.3729.157 Chrome/74.0.3729.157 Safari/537.36
Chromium 74
Linux
Desktop
5 years ago
Test name Executions per second
getElementById() 1730015.5 Ops/sec
getElementsByClassName() 1086435.0 Ops/sec
getElementsByTagName() 1216000.2 Ops/sec
querySelector(#id) 817224.9 Ops/sec
querySelector(.id) 1367342.5 Ops/sec
querySelectorAll(#id) 345042.5 Ops/sec
querySelectorAll(.id) 470535.8 Ops/sec
jQuery(#id) 398039.1 Ops/sec
jQuery(.id) 180842.7 Ops/sec
jQuery(tag#id) 112882.4 Ops/sec
jQuery(tag.id) 112470.7 Ops/sec
jQuery + getElementById 579182.4 Ops/sec
jQuery + getElementsByClassName 205242.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


;