Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
Firefox 65
Windows 7
Desktop
5 years ago
Test name Executions per second
getElementById() 1976288.2 Ops/sec
getElementsByClassName() 2048675.0 Ops/sec
getElementsByTagName() 2274790.2 Ops/sec
querySelector(#id) 2242260.5 Ops/sec
querySelector(.id) 2319753.2 Ops/sec
querySelectorAll(#id) 679219.0 Ops/sec
querySelectorAll(.id) 824868.9 Ops/sec
jQuery(#id) 2305888.2 Ops/sec
jQuery(.id) 413640.6 Ops/sec
jQuery(tag#id) 200218.8 Ops/sec
jQuery(tag.id) 239564.4 Ops/sec
jQuery + getElementById 1667678.0 Ops/sec
jQuery + getElementsByClassName 511480.2 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


;