What's faster for including scripts, using CDN (Google) or storing them locally in website's root?

前端 未结 7 1340
眼角桃花
眼角桃花 2020-12-02 14:55

What\'s faster for including scripts, using CDN (Google) or storing them locally in website\'s root?

7条回答
  •  借酒劲吻你
    2020-12-02 15:18

    Unfortunately studies have recently shown that Googles CDN actually hinders performance.

    Google's AJAX Libraries API tried to uses network effects to improve performance of all participating websites by providing a common shared cache. However recent research has discovered that too few people use the network for it to hit critical mass and actually improve web performance. Currently the overhead in using the network means using Google's AJAX Libraries API actually lowers performance. You should host the JavaScript file locally. This will increase your bandwdith consumption but improve page load speed. From Zoompf.com performance report note.

    See here also Should You Use JavaScript Library CDNs?

提交回复
热议问题