Minify & Gzip vs Google CDN

試著忘記壹切 提交于 2019-12-24 11:48:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!