Run details:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0
Firefox 64
Windows 7
Desktop
5 years ago
Test name Executions per second
getElementById() 2145481.2 Ops/sec
getElementsByClassName() 2038607.5 Ops/sec
getElementsByTagName() 2300424.2 Ops/sec
querySelector(#id) 2210144.5 Ops/sec
querySelector(.id) 2293864.8 Ops/sec
querySelectorAll(#id) 688974.2 Ops/sec
querySelectorAll(.id) 829003.8 Ops/sec
jQuery(#id) 1692114.0 Ops/sec
jQuery(.id) 629723.4 Ops/sec
jQuery(tag#id) 369063.9 Ops/sec
jQuery(tag.id) 443948.3 Ops/sec
jQuery + getElementById 1646128.4 Ops/sec
jQuery + getElementsByClassName 705327.4 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


;