Topic awaiting preservation: Old optimzer tricks (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: |
posted 10-29-2004 01:07
Well.. it's quiet here, so why not ask some questions.. |
Paranoid (IV) Inmate From: France |
posted 10-29-2004 15:36
There is some Javascript compressors. One of the most famous being Javascript Compression at http://www.dithered.com. Most of the real JavaScript compressors ( not those crap that trim the lines, remove the comments and pretend to compress effectively the code ) I've seen were based on the same method and had more or less the same constraints. |
Nervous Wreck (II) Inmate From: |
posted 10-30-2004 21:12
Ok, but unrolling loops and precalcing etc. take time and extra code. My idea is so that a generic compression - which is optimised for JS - can be written in anything (I would use Delphi, say) and compresses the entire script into one large array of data. A small decompression routine can decompress the entire block to a raw fresh window or frame and jump into the expanded code. |
Paranoid (IV) Inmate From: France |
posted 10-30-2004 23:14
I did my JS packer in PHP. Basically It uses the method from dithered.com ( though I found it somewhere else before ) and provides 3 different types of tokens allowing respectively a maximum of 91, 95 and 127 strings replaced. I do the "fake" tricks by hand before. |
Nervous Wreck (II) Inmate From: |
posted 10-31-2004 00:46
I`ve just been looking at if it was possible to implement the gzip or deflate content-encoding capability. I use this for server-side page delivery with DB apps, and most generated pages are aound 10% of original size. |
Paranoid (IV) Inmate From: France |
posted 10-31-2004 02:06
I've never heard of a way to touch the HTTP headers ( except for cookies ) on client side except with an xmlHTTPrequest object where it's possible to send/receive an HTTP request and indeed use different content-encoding methods. But that new object is supported since little time by the the 4 major browsers. |
Obsessive-Compulsive (I) Inmate From: Christchurch |
posted 10-31-2004 06:15
I've been using the w3compiler to shrink my JS size. Its really useful. Removing whitespace reduces the file size by about 7%. It also has a setting for variable renaming and object remapping. Switching all these on reduces file size by over 20% in some cases. I don't enable these settings, however, since it caused a problem with a couple of my games. |