>
> Well....
>
> The page downloads in linear (line by line) so it depends...
>
> If you reference your JS via src="/path/to.file.js" ... and have
> many of
> these files then you will be stunted by the paralell download
> stopping.
>
> However.... If you do some smart js thinking (like i did!!!!!!!!)
> you can
> make thigs very fast indeed...
>
> Basically what i done was..
>
> Created a file that minifies my js files on the fly and outputs one
> long
> minified whitespace stripped string back to the browser which
> includes all
> of the javascript needed to run on any page ..
Like http://getsprockets.com/ ?
//jarkko
--
Jarkko Laine
http://jlaine.net
http://dotherightthing.com
http://www.railsecommerce.com
http://odesign.fi
Concatenate all files into one in the order that you are loading them, use yui
compressor, gzip. You'll see at least an 80% decrease in load time.
Still, I'd question the sanity of any system that takes 30 seconds to serve a
web page.
Jim
Remember that you decide what you want and what you do not want to
concatenate.
At our company we have two "types" of scripts:
1) Framework scripts, such as prototype, scripty, and our own
framework additions, widgets (calendars, table filters, etc).
Those are common through all the system. It might be, that some parts
are not necessary everywhere, but generally they are used across most
of the pages.
2) Page logic, which are distinct per module, or even per specific
page. This is the place where we initialize all the event handlers,
and here we put the scripts specific for the module, and configuration
for the widgets and so on. Each script used once should be in this
category.
So, each page grabs a concatenated, minified, compressed, versioned!
and cacheble! set of ALL files from category 1.
Then the page requests the creation of the concatenated, minified,
compressed, versioned and cacheble the scripts IT NEEDS from category
2. This is saved serverside, so it is done once after any change to
any of used scripts. The framework puts a second <script> tag to
include page specific concatenated scripts.
So, we end up in two script tags per page load, which both are small
in size, and are cached client-side after first load of the page.
No need to create one huge file for the whole application. Common part
are cached separately, and specific parts are also cached, as the user
of an Application usually uses a number of modules in his/her work
many times a day.
Best regards,
SWilk