

Compression of JavaScript programs - DanielH
http://www.bitsnbites.eu/?p=20

======
dexen
A document [1] by Ray Cromwell introduces an aid for JS compression, both
theory and implementation [2]. The idea is to transform JS code before
compression in a way that, while keeping JS semantics, makes is best possible
candidate for the popular gzip deflate compression.

\----

[1] [http://timepedia.blogspot.com/2009/08/on-reducing-size-of-
co...](http://timepedia.blogspot.com/2009/08/on-reducing-size-of-
compressed.html)

[2] [http://code.google.com/p/google-web-
toolkit/source/detail?r=...](http://code.google.com/p/google-web-
toolkit/source/detail?r=5972)

~~~
follower
That's a really awesome article--I remember when I first read it that it was
both really interesting, well written and useful knowledge.

I thoroughly recommend taking the time to read it.

------
willvarfar
_cough_ your server could serve gzipped stream and the browser would
transparently uncompress it.

Sure there are browsers that can't decompress these streams, but your
webserver already knows when to send the full (but minified) JS instead. Its
all handled automatically.

~~~
nrkn
He mentions "small source size" competitions as one of the reasons for doing
this and they all count the size of the raw js file, not the size of the
gzipped file as sent by the server.

------
verisimilitude
This is a great process to maximize your JS compression. However, it's
important to keep in mind the application. From the jQuery dl page (yes, they
use a different compression method):

"The packed versions require non-trivial client-side processing time to
uncompress (unpack) the code whereas the minified versions do not."

