What's faster for including scripts, using CDN (Google) or storing them locally in website's root?
CDNs deliver faster loading speeds for readers. Because this content is readily available, it is pushed to users faster than would be the case in a local website server.
If you know what you want to use, use a local copy of jQuery, so you are not dependent on a third party. If you try out things with several libraries, use the CDN, because it's quicker and once you're done, use local copies for the reason mention before.
The advantages of using jQuery CDN are as follows: Decreasing the load on your website since the jQuery file will be loaded from a CDN and not from your website. The CDN will reduce the load on your website by loading the data from CDN and not directly from the website.
The best-performing CDN depends a bit on your needs. If you don't need HTTPS support, the fastest CDN is actually the official jQuery CDN, provided by Media Temple. Google's Libraries API CDN is a good second choice after that. If you need support for HTTPS, your best option is Google's Libraries API CDN.
If you mean the core jQuery libraries, use the google CDN for an internet-facing site (as opposed to an internal one).
The CDN has the following advantages you'll find hard to compete with:
Though you can configure the cache headers just like they do, you probably can't serve the file faster. That being said, the library/CDN is only part of the puzzle. Miscellaneous plugins and code you have should also be minified, combined and served via gzip.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With