[Javascript] performance. WAS:external scripts

allard schripsema allard-schripsema at procergs.rs.gov.br
Tue Jun 22 14:15:58 CDT 2004


Hello All
Sorry about reacting this late to this thread, but something is bugging me
with this "Crunchinator" ....
Why would one want to crunch code for performance if the code is compressed
by the modem (v42 for example)?

I´m working on the performance in the project I work for, so i´d like to
know if "crunching" really has an effect, not in bytes, but in seconds.....

Allard

----- Original Message ----- 
From: "Mike Dougherty" <mdougherty at pbp.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Monday, June 21, 2004 12:09 PM
Subject: Re: [Javascript] external scripts


Crunchinator Demo took one of the main files and trimmed 38% of what is
primarily whitespace
readable code is tab indented, doesn't heavily overload each line, put
spaces around operators,
etc. which can all be stripped with the comments that describe the what's
going on in each control
structure.

   Most of this code is rendering HTML, so there is the associated bloat of
html.  The whole thing
is procedural to start with, so I doubt I can get further economy
proceduralizing anything else.
 (that's why there's 20+ scripts, each is an object w/ method functions)

   If simple whitespace and comment removal isn't enough, i will consider
translating the
procedure names and variables - but that will increase the chance for a
false conversion due to
mixed string delimiters.

to see what i'm talking about, note the lag time between clicking "Add to
Cart" and having the
product customizer load:
https://www.pgiproducts.com/pgi.asp?SKU=DP00018&ID=123

   hmm... there's also a round-trip redirection in there too, maybe i can
eliminate that (which
should help dial-up performance immensely)

On Mon, 21 Jun 2004 10:33:54 -0400
  "Chris T" <christ at saeweb.com> wrote:
>I don't think you neccessarily need to combine the files. I don't see much
>of a gain from doing so and if only one small portion needs updating in the
>future, the user will need to update the WHOLE .js file instead of the
small
>.js file that needs to change later on.
>
>90k sounds like an awful lot though. How much of that is comments?  How
much
>of this is redundant code that might be able to be functionalized/optimized
>a bit better?
>
>Chris Tifer
>
>
>
>
>----- Original Message ----- 
>From: "Mike Dougherty" <mdougherty at pbp.com>
>To: "[JavaScript List]" <javascript at LaTech.edu>
>Sent: Monday, June 21, 2004 10:09 AM
>Subject: [Javascript] external scripts
>
>
>I have a client-side browser app composed of about 20 external scripts
>totalling about 90k
>
>I viewed this site over dial-up and realized there has to be some
>optimization to make the site
>more palatable for dial-up (and consequently improve performance on
>broadband too)
>
>I'm guessing a single monolithic script file would be retrieved and cached
>by the browser more
>efficiently than 20 separate files - is this a correct assumption?
>
>I also have inline comments in the script- these are useful for whatever
>developer go back to the
>source for upgrades, but serve only to bulk up the download for the
>customer.
>
>Since I'm going to collect these 20+ separate scripts into a single
download
>anyway, I plan to
>remove the comments too.  Can someone provide me with the regexp to remove
>everything between /*
>and */?  (the / needs to be escaped, and isn't the * a wildcard?  i really
>don't "get" regexp like
>i want to)
>
>What is the 'best practice' for maintaining readible source code for
>developer use and
>pseudo-compiled script for browser consumption?
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list