Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0
Firefox 49
Windows
Other
8 years ago
Test name Executions per second
getElementById() 11338693.0 Ops/sec
getElementsByClassName() 3861180.5 Ops/sec
getElementsByTagName() 5143205.0 Ops/sec
querySelector(#id) 6179194.5 Ops/sec
querySelector(.id) 429542.1 Ops/sec
querySelectorAll(#id) 1522432.6 Ops/sec
querySelectorAll(.id) 46598.7 Ops/sec
jQuery(#id) 2080459.5 Ops/sec
jQuery(.id) 417425.8 Ops/sec
jQuery(tag#id) 288537.8 Ops/sec
jQuery(tag.id) 39292.6 Ops/sec
jQuery + getElementById 2464477.0 Ops/sec
jQuery + getElementsByClassName 568918.5 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


;