WebPagetest Forums
Google Ajax library for serving jQuery? - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: Web Performance (/forumdisplay.php?fid=3)
+--- Forum: Optimization Discussions (/forumdisplay.php?fid=5)
+--- Thread: Google Ajax library for serving jQuery? (/showthread.php?tid=10979)



Google Ajax library for serving jQuery? - Grey - 04-10-2012 01:15 PM

I read recently that cloudflare also offers a version of their cdn for jQuery called cdnjs.com -

Anybody have any experience with using these for increasing optimization?

This is a nice article on it: http://encosia.com/3-reasons-why-you-should-let-google-host-jquery-for-you/


RE: Google Ajax library for serving jQuery? - Avi Keinan - 04-11-2012 12:47 AM

I used google cdn for jquery hosting (thought that most of the users will hit the file from cache),
After couple of tests, i figure out that if i will combine all the js files on my website and host the file on my webserver, it will be faster then google.

But, this is probably because google don't have cdn pop in Israel.


RE: Google Ajax library for serving jQuery? - fritzelly - 04-11-2012 02:27 AM

I pinged them from my server (London) and google was about 1ms faster, and from home (Ireland) google was three times faster. So maybe it will depend on your location as to whether it is better.
But also remember its new so not many website would be using it, so better stick with google where you get the benefit of cached libraries, until it is more widespread.


RE: Google Ajax library for serving jQuery? - Avi Keinan - 04-11-2012 03:11 AM

Not if you have 70% of returning visitors, and you have combined all your js files into one (cached) file.


RE: Google Ajax library for serving jQuery? - fritzelly - 04-11-2012 03:23 AM

(04-11-2012 03:11 AM)Avi Keinan Wrote:  Not if you have 70% of returning visitors, and you have combined all your js files into one (cached) file.

Well then that has nothing to do with using a cdn for the libraries.


RE: Google Ajax library for serving jQuery? - andydavies - 04-12-2012 04:04 AM

(04-11-2012 02:27 AM)fritzelly Wrote:  I pinged them from my server (London) and google was about 1ms faster, and from home (Ireland) google was three times faster. So maybe it will depend on your location as to whether it is better.
But also remember its new so not many website would be using it, so better stick with google where you get the benefit of cached libraries, until it is more widespread.

It's not just the ping time is it though...

There's the time to resolve the DNS and make a new connection - I've seen a couple of cases where a site might be better serving jQuery from it's own domain rather than Google...

But a couple of samples really isn't enough to make an informed decision.


RE: Google Ajax library for serving jQuery? - mrPerezMarc - 04-12-2012 05:21 AM

You have to treat your visitors like they are comming to your site first with a primed cache(empty)
If you really care about speed, then you will make sure to load your JS after onload.


RE: Google Ajax library for serving jQuery? - Avi Keinan - 04-20-2012 04:03 AM

Also, you need to remember that javascript blocks page render, so any delay in dns lookup/connect time/ttfb/or even crash (yes, google is not god, it can crash), will delay your page loading.