Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0
Firefox 50
Windows
Other
7 years ago
Test name Executions per second
getElementById() 10466829.0 Ops/sec
getElementsByClassName() 3522511.8 Ops/sec
getElementsByTagName() 4721730.0 Ops/sec
querySelector(#id) 5512297.5 Ops/sec
querySelector(.id) 402049.9 Ops/sec
querySelectorAll(#id) 1307155.6 Ops/sec
querySelectorAll(.id) 47235.5 Ops/sec
jQuery(#id) 1814729.6 Ops/sec
jQuery(.id) 398832.0 Ops/sec
jQuery(tag#id) 247967.8 Ops/sec
jQuery(tag.id) 39732.3 Ops/sec
jQuery + getElementById 4360422.5 Ops/sec
jQuery + getElementsByClassName 495343.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


;