Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36
Chrome 62
Linux
Other
7 years ago
Test name Executions per second
getElementById() 2410023.8 Ops/sec
getElementsByClassName() 1638188.5 Ops/sec
getElementsByTagName() 1989798.4 Ops/sec
querySelector(#id) 2021236.6 Ops/sec
querySelector(.id) 524699.4 Ops/sec
querySelectorAll(#id) 926520.6 Ops/sec
querySelectorAll(.id) 75351.4 Ops/sec
jQuery(#id) 749717.9 Ops/sec
jQuery(.id) 210379.0 Ops/sec
jQuery(tag#id) 187776.3 Ops/sec
jQuery(tag.id) 28439.7 Ops/sec
jQuery + getElementById 443110.4 Ops/sec
jQuery + getElementsByClassName 122747.8 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


;