

Ask HN: Performance hit for jQuery Download? - shiny

I'm using JQuery for the first time on a new site.  I love it, but I had some worries.<p>I really want my site to be snappy, but it seems that downloading JQuery, even when minified, can cause a decent performance hit.<p>Is this worry justified?  If so, is there anything I can do?  Can something like GWT do the same basic stuff that JQuery does (and thus reap the performance benefits from less code to DL)?<p>Also, if this is a problem, and since I see a lot of sites using jQuery these days, why can't the browsers bundle the framework in their browser so the user doesn't have to download it each HTTP hit (of course, using the bundled framework would be optional)?<p>Thank you.
======
csomar
if you grab Jquery from Google, you'll get more performance especially in
speed, as the browser need to download it only once and then can work with it
on all sites

Read more here [http://encosia.com/2008/12/10/3-reasons-why-you-should-
let-g...](http://encosia.com/2008/12/10/3-reasons-why-you-should-let-google-
host-jquery-for-you/)

------
noodle
use google's ajax libraries. they do everything for you, including caching
them properly.

<http://code.google.com/apis/ajaxlibs/>

------
wvenable
Let google host it for you: <http://code.google.com/apis/ajaxlibs/>

Using Google's version also means that it will only be cached once between all
the sites that use it. This is similar to what you're talking about with
bundling it in the browser,

------
sarvesh
You need to set the cache control for the file to some far off date in future.
Doing this will make sure the browser doesn't download the file each and every
time the users visits your website. If you are using Apache you add this to
your conf file.

<FilesMatch "\\.(jpg|jpeg|png|gif|js|css)$"> Header set Cache-Control "public"
Header set Expires "26 June 2210 20:00:00 GMT" </FilesMatch>

