I'm hosting the javascript for my site on Cloudfront. Should I bundle jQuery in with the package, or use a public CDN? I'm primarily interested in mobile performance.
The pro of bundling is one fewer script file to download. The pro of a public CDN is that it's more likely to already be in the user's cache.
It sounds like the CDN to pick for likelihood to have in cache is Google's (based on the research here: http://royal.pingdom.com/2012/06/20/jquery-numbers/), but in practice does that outweigh having one fewer file? When you take into account the % of sites that use jQuery (~50%) * the percentage of those that use Google's CDN (25%) * the percentage of those using jQuery 1.10.2 (??%), is a significant chunk of my visitors going to have it cached?
Bundling is not a recommended option as set out in this blog post by the Google Chrome V8 developers.
The recommended solution is to use open-source libraries from public CDN and serve the other files separately.
Since you are concerned about the mobile performance, I would recommend you to:
PageCDN does all of this for you. It can mutiplex public libraries and private files over the single connection. Plus, it compresses resources using brotli-11 compression that compresses files far more tightly. It also supports immutable caching and HTTP/2 Server Push.
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