There are more things you can do, and better ways of doing these. Apache will automatically handle comptression (and caching of compressed content) which massively simplifies management of filse. Making javascript properly cacheable will yeild big benefits. Wildcard domains (with multiple URIs) will allow more concurrent connections. Pre-fetching is not just for images/
–
symcbeanJul 19 '10 at 8:36

If you're lucky, the user has already visited some other site that used the same library from the same provider, so they already have it in the browser cache.

Note: The version you ask for can have a large impact on the caching characteristics: asking for jQuery 1.4.2 will give you a file that can be cached for a year, but 1.4 can only be cached for an hour.

Can you expand on your 'note'? Why is there a difference in the caching time?
–
theycallmemortyJul 15 '10 at 19:49

2

@theycallmemorty: While I've not checked the docs, I'd assume that it's because by specifying 1.4.2 you're being very specific about the version you want, while asking for 1.4 you're basically saying "give me the most recent version under 1.4", so they are not caching it as heavily.
–
Zhaph - Ben DuguidJul 15 '10 at 22:50

Also worth noting is that Microsoft makes some JS libraries (jQuery and some MS specific ones) available on their CDN which also supports https (which many other script CDNs do not support) asp.net/ajaxlibrary/cdn.ashx
–
Bert LambJul 19 '10 at 14:03

You can put the whole library into one js file and compress the file. However, it really only matters for the first loading of a page. After this your js file will be cached in the browser, in particular if you set the cache-expiration long enough. Hence any consecutive hit will not load your js file anymore.

...in some situations, it’s worthwhile
to take a bunch of resources that are
being downloaded on a single domain
and split them across multiple
domains. I call this domain sharding.
Doing this allows more resources to be
downloaded in parallel, reducing the
overall page load time.

elsewhere he writes..

Browsers open a limited number of
connections per domain...Splitting, or
sharding, the requests across two
domains, as opposed to one domain,
results in a faster page, especially
in IE 6 & 7