Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36
Chrome 66
Linux
Desktop
6 years ago
Test name Executions per second
getElementById() 3488143.2 Ops/sec
getElementsByClassName() 2397224.2 Ops/sec
getElementsByTagName() 2897942.0 Ops/sec
querySelector(#id) 2155415.2 Ops/sec
querySelector(.id) 2962890.2 Ops/sec
querySelectorAll(#id) 999822.8 Ops/sec
querySelectorAll(.id) 1289863.1 Ops/sec
jQuery(#id) 1316160.2 Ops/sec
jQuery(.id) 618292.1 Ops/sec
jQuery(tag#id) 374270.8 Ops/sec
jQuery(tag.id) 352279.3 Ops/sec
jQuery + getElementById 1291263.0 Ops/sec
jQuery + getElementsByClassName 453697.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


;