Google Groups

Re: [jquery-bugs-team] File Size Considerations


John Resig Nov 18, 2011 12:44 PM
Posted in group: jQuery Bugs Team
>> If this is an argument about better load times, there are other issues to
>> consider, and I don't know how this affects either argument.  Some
>> questions:
>> - Will cutting out unneeded pieces of jQuery actually help page loads?  As
>> soon as one compiles their code + jQuery, the benefit of caching from the
>> CDN is lost (there's no way we can beat the load time when loaded from
>> cache).
>> - So, how often is jQuery loaded from the CDNs?
>
> I read an article that, unfortunately, I'm unable to find again that
> put the cache hit rate to be rather low. Combine that with mobile in
> which the file may not be cached to begin with and you have more
> requests than you need (and doing more DNS lookups to boot).

Ah, found it:
http://zoompf.com/blog/2010/01/should-you-use-javascript-library-cdns

So the important take away here: Even if you're using Google's CDN,
the likelihood that you'll be getting a pre-cached copy of the library
that's using the same version that you have is rather low. Undoubtedly
the biggest benefit of the Google CDN isn't performance, per se, it's
the fact that it wastes none of your bandwidth, is a reliable server,
and is already minified and gzipped.

To provide a counter-example to Rick, we use this particular technique
(all JS in one file, minified and gzipped) at Khan Academy. (Although
we're not using CC yet, I'm sure we'd love to if given the chance.)

--John

--John