Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0
Firefox 62
Linux
Desktop
6 years ago
Test name Executions per second
getElementById() 1053696.6 Ops/sec
getElementsByClassName() 1182259.8 Ops/sec
getElementsByTagName() 1242855.6 Ops/sec
querySelector(#id) 1256649.2 Ops/sec
querySelector(.id) 1106386.9 Ops/sec
querySelectorAll(#id) 393214.4 Ops/sec
querySelectorAll(.id) 635142.2 Ops/sec
jQuery(#id) 1163968.1 Ops/sec
jQuery(.id) 390525.7 Ops/sec
jQuery(tag#id) 217898.9 Ops/sec
jQuery(tag.id) 266740.4 Ops/sec
jQuery + getElementById 1267931.8 Ops/sec
jQuery + getElementsByClassName 331201.4 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


;