问题
Should I minify/gzip my Jquery with my other scripts on my page, or use Google CDN for Jquery & JQuery UI and gzip my own stuff.
From what I can see its more likely to be faster to deliver from Google and there is a better chance the files will be cached already on the users machine, however its a couple of extra http request and at least I know it will always be available.
回答1:
You got it right. For widely-used librairies, using Google CDN is a good idea:
- uses less bandwith on your server
- resources availability is great
- servers location is good too (it's a CDN after all!)
- like you said, better chances these resources will be cached already on the user's side
The only downside:
- adds a DNS query, because you're hosting resources on an additional domain. Reducing DNS lookups is quite important.
So the anwser is "use Google CDN".
来源:https://stackoverflow.com/questions/3839735/minify-gzip-vs-google-cdn