Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36
Chrome 77
Linux
Desktop
5 years ago
Test name Executions per second
getElementById() 5153740.5 Ops/sec
getElementsByClassName() 3294057.0 Ops/sec
getElementsByTagName() 4134730.8 Ops/sec
querySelector(#id) 2757658.5 Ops/sec
querySelector(.id) 4065314.5 Ops/sec
querySelectorAll(#id) 1343431.5 Ops/sec
querySelectorAll(.id) 1741720.0 Ops/sec
jQuery(#id) 1624927.5 Ops/sec
jQuery(.id) 792029.8 Ops/sec
jQuery(tag#id) 457722.7 Ops/sec
jQuery(tag.id) 470032.7 Ops/sec
jQuery + getElementById 1888861.2 Ops/sec
jQuery + getElementsByClassName 725779.6 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


;