Something you should NOT do is merge all your JavaScript into a single file. If you ever make changes to your code base, this file is recreated ... and redistributed to each visitor. The HTTP overhead is pretty small, so if you donβt upload hundreds and thousands of unique files, downloading 20 different files compared to downloading 1 large will not differ from the differences, except for users with exceptionally slow connections (who will wait for a large file anyway, therefore, they will not notice extra seconds or two of the HTTP resources).
ToonMariner's recommendation on using hosted code (in particular, from the Google Code repository) is good - it eliminates the need to host a file, it allows users who encounter this file to use caching (improving the apparent loading speed of your site), and if you make changes, it will not be included in your concatenated file. Even if you decide to save the entire application in one large file, you should study it, since you can avoid jQuery packaging and save 50 + kb.
Also, your concern about interpreting the AndWhistlesPlugin () bells is correct - the this function in the bellsAndWhistlesPlugin function is just an empty list (although I should hope that the plugin will call $ (this) .each to iterate over the elements and return early, since there are no elements ... otherwise you may want to return to your plugins!). You can fix this problem by removing the page-specific code from your complete application.js file and placing it in the inline <script> element on the page itself, where it still belongs, or rewriting the plugin to return it earlier if not relevant items.
Just make sure that you enable caching for resources downloaded from the / js directory, and you wonβt have problems reloading the libraries β only those that have been changed. You can use the Expires header or the Last-modified header; Expires will not necessarily be a forced update if the user does not restart or the cache has expired, and Last-modified causes HTTP overhead for each file, which is problematic for more files. You will need to appreciate the tradeoffs for your application.
If you are really seriously interested in maximum efficiency, you can rewrite your application using GWT . This technically guarantees maximum portability between browsers, maximum code efficiency, eliminates jQuery library dependency, will run faster and produce much smaller files. Everything in one file, I could add, but the compromises to get a static compiler for maximum JavaScript performance are worth it ... if you are ready to rewrite it all in GWT.
The question you should ask yourself is: who is my average user? What connection does he have? Should my application work on mobile devices? If your average user has a fast connection, don't worry about it - they will load your page fast enough, no matter which one you choose. If you need to work on mobile devices, or your intended audience has slow connection speeds, consider caching large libraries that change very rarely and using external repositories where they are available (e.g. jQuery), then pack the rest of your applications in one large file, HTTP overhead for mobile devices and slow Internet are significant enough to guarantee this.