[Javascript] external script cache and script stripping

Allard Schripsema allard-schripsema at procergs.rs.gov.br
Fri Oct 8 14:33:15 CDT 2004


Hi Mike,
In general I think it´s a good idea to spead the loading of the scripts.
The only "But" i can see is that your homepage (first page seen by the user)
will load a bit slower. And that may be a problem, so my suggestion is to
start doing it from the second page.

About cleaning code and stuff, I did some research into that myself and
somewhere on the way somebody told me that it´s not really necessary since
the code gets compressed before sending it to the client.
You may do it motivated by memory-usage though, it can´t hurt i think

Thats my 2 centavos (from Brazil ;-)

Allard


-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu]On Behalf Of Mike Dougherty
Sent: Friday, October 08, 2004 2:56 PM
To: [JavaScript List]
Subject: [Javascript] external script cache and script stripping


I did some analysis on one of the modules in my client-side js-driven
application.

To my understanding, the customer's browser will cache the external script
files.  To improve the
perceived performance of the application (which currently feels slow to
start because of initial
download time) - i was considering delivering several of these scripts on
each of the preceeding
pages on the site so the user can have already cached the external scripts
before they reach the
application page. Imagine the user clicks through 4 pages before using this
interactive js app -
deliver scripts 1-5 on page 1, 6-10 on page 2, 11-15 on page 3 even though
they are not used on
those pages.  When page 4 uses all 20 scripts, the download time is only for
scripts 16-20.  Call
it a script preload strategy.  At this point, don't worry about the actual
implementation - just
the concept of it.

Also- by removing tabs (chr(9)), extra spaces around operators (" = "," +
"), and block comments
(/* */) the file is now 45% smaller (29744b -> 19551b)  The unstripped code
in 20 files is 109Kb.
 I plan to have a custom control running server-side to automatically
compare the source version
against the stripped version and "recomile" if the source is newer - because
manually maintaining
versions would be painful for the lazy developer (myself) [note: i use the
term 'stripped' because
i have no intention of trying to "compress" the file by tokenizing
keywords/variables, etc. as i
have seen available.]

What are your opinions of 1. my idea of script preload, and 2. having a
developer "source" version
of external javascripts and a "stripped" version for delivery to browsers?
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list