Run details:
Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0
Firefox 64
Windows 8.1
Desktop
5 years ago
Test name Executions per second
getElementById() 2034536.5 Ops/sec
getElementsByClassName() 2179151.5 Ops/sec
getElementsByTagName() 2204346.2 Ops/sec
querySelector(#id) 2300603.0 Ops/sec
querySelector(.id) 2220885.8 Ops/sec
querySelectorAll(#id) 720784.8 Ops/sec
querySelectorAll(.id) 1053846.1 Ops/sec
jQuery(#id) 2694946.5 Ops/sec
jQuery(.id) 692778.9 Ops/sec
jQuery(tag#id) 406900.5 Ops/sec
jQuery(tag.id) 449763.8 Ops/sec
jQuery + getElementById 1827875.4 Ops/sec
jQuery + getElementsByClassName 662271.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


;