Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36
Chrome 62
Linux
Desktop
6 years ago
Test name Executions per second
getElementById() 2898202.8 Ops/sec
getElementsByClassName() 2012800.8 Ops/sec
getElementsByTagName() 2633687.5 Ops/sec
querySelector(#id) 2124978.0 Ops/sec
querySelector(.id) 2677135.2 Ops/sec
querySelectorAll(#id) 884339.0 Ops/sec
querySelectorAll(.id) 1137585.4 Ops/sec
jQuery(#id) 1161459.4 Ops/sec
jQuery(.id) 584791.6 Ops/sec
jQuery(tag#id) 326300.2 Ops/sec
jQuery(tag.id) 329693.9 Ops/sec
jQuery + getElementById 1260504.1 Ops/sec
jQuery + getElementsByClassName 448671.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


;