Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Chrome 56
Mac OS X 10.11.1
Other
7 years ago
Test name Executions per second
getElementById() 2490212.8 Ops/sec
getElementsByClassName() 1756295.1 Ops/sec
getElementsByTagName() 2079281.8 Ops/sec
querySelector(#id) 2065536.5 Ops/sec
querySelector(.id) 531761.4 Ops/sec
querySelectorAll(#id) 951362.4 Ops/sec
querySelectorAll(.id) 73476.8 Ops/sec
jQuery(#id) 945160.9 Ops/sec
jQuery(.id) 490202.2 Ops/sec
jQuery(tag#id) 311840.9 Ops/sec
jQuery(tag.id) 54617.5 Ops/sec
jQuery + getElementById 1083606.4 Ops/sec
jQuery + getElementsByClassName 348379.3 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


;