views:

282

answers:

3

What percentage of browsers would probably have Google's cached version of JQuery already loaded?

I am asking this to figure out how fast my page would load on an "average" browser. My page needs both JQuery and JQuery UI. I believe most browsers would probably have JQuery already cached from Google's servers. Is this true? And what are the numbers for JQuery UI?

Any proof of your claim would be helpful.

Also, for Jquery UI: What components does Google's Jquery UI have? Does it have all of them or just a few (sortable, etc...)?

Also, I think it's about 180 kb. Should I use that or should I create a custom.ui.min at jqueryui.com that might be smaller?

+1  A: 

I'm not sure anyone could answer that. But more importantly: does it matter? It loads once and that's it (well, until a new jQuery version is released depending on what URL you use).

I'm not sure I understand the relevance of such a statistic in that context.

cletus
+3  A: 

According to Best Practices for Speeding Up Your Web Site:

Reducing the number of HTTP requests in your page is the place to start. This is the most important guideline for improving performance for first time visitors. As described in Tenni Theurer's blog post Browser Cache Usage - Exposed!, 40-60% of daily visitors to your site come in with an empty cache. Making your page fast for these first time visitors is key to a better user experience.

This is relevant because for 40-60% of your daily visitors, it doesn't matter where you load the jQuery library from, they won't have it in their cache.

I also think there is more to the question then how often your visitors will have it cached. Do you want to take a dependency on an outside company you do not control, even one as large as Google? What if Google is down (it has happened)? What if Google suddenly decides to stop hosting jQuery while you are on an extended vacation? What if a Google employee makes a mistake and overwrites your specified version with a new version of jQuery that breaks functionality on your page?

Grant Wagner
Most of the concerns you bring up about google hosting can be solved with the simple implementation found in this thread: http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-goo
zombat
@Grant: that's a surprising large number. thanks for the info
chris
@zombat: thanks for the link.
chris
This is not accurate. 40-60% of users will not have resources from your site cached, but the Google API cache is different. The Google jQuery URL remains cached in the browser for one year (or until cleared). Many users will have jQuery cached, even if they've never seen your site before.
Matthew
A: 

The percentage would differ very much depending on where the visitors are from. For visitors from Sweden for example the percentage would be nearly zero, as they don't load the files from google.com, but are automatically redirected to google.se instead.

I think that Google have the same setup in a lot of countries, so the overall percentage that would have the files loaded from google.com would be quite small.

Guffa
I don't think people cache a version of jquery from going to google.com directly but from the large number of other sites which use the versions of jquery hosted by google.
zenna