开发者

Minify & Gzip vs Google CDN

开发者 https://www.devze.com 2023-01-18 14:42 出处:网络
Should I minify/gzip my Jquery with my other scripts on my p开发者_StackOverflow中文版age, or use Google CDN for Jquery & JQuery UI and gzip my own stuff.

Should I minify/gzip my Jquery with my other scripts on my p开发者_StackOverflow中文版age, 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.


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".

0

精彩评论

暂无评论...
验证码 换一张
取 消