LZ77 JavaScript Compressor Reloaded

Updated: June 4, 2007, LZ77 JavaScript Compressor http://demo.java2script.org/lz77js/ is rebuilt using Java2Script Simple RPC technology.

In early of this year, I had a post “LZ77-JS-Compressor: Another way of compressing JavaScript“. It seemed that lots of people were seeking pure LZ77 JavaScript Compressor, and some of them clicked the above post. And the above link is on the top 2 position for key world “js compressor” in Google.

As mentioned in the above post, pure JavaScript decoder’s performance was very poor for large *.js file (>200k)! So I stopped focusing on further development of LZ77 JS compressor after the post. So no technical details were found there but pure LZ77 JS compressor’s poor performance was told there.

But as top 2 position link for key world “js compressor” in Google, I decide not to disappoint visitors with no discrete implementations any more. Here now, I give an implementation (Thanks for J2S 1.0.0 M3, so such a solution does not require much time and pains):

LZ77 JavaScript Compressor“: This is a J2S/SWT application, sending the raw JavaScript sources back to server to do LZ77 compressing (Java servlet). (Mentioned: the server s eems being unstable with low bandwidth.)

J2S SWT LZ77 JavaScript Compressor

If you uncheck “RegExp trimming before LZ77” option in the above application, you can compress any plain text (HTML/CSS/SVG/…) besides JavaScript sources.

This LZ77 implementation was considered as buggy. I used in J2S Clazz.

BTW: Developing the above J2S/SWT application (including wrapping the old LZ77 utilities into a servlet) took me about 2 hours.

For JS compressor, I recommend you to use Dean’s Packer.

PS: “LZ77 JavaScript Compressor” is now using LZ77-JS-Comopresser compressed JavaScript: http://bl.ognize.com/j2s-ajax-rss-reader/net.sf.j2s.lib_1.0.0.v320/j2slib/j2slib.lz77.z.js (30k) rather than earlier http://bl.ognize.com/j2s-ajax-rss-reader/net.sf.j2s.lib_1.0.0.v320/j2slib/j2slib.z.js (55k)

This entry was posted in AJAX, JavaScript, Sharing. Bookmark the permalink.

7 Responses to LZ77 JavaScript Compressor Reloaded

  1. Bart Guijt says:

    Hi,

    I tried the compressor (interesting way to compress code!) and stumbled upon the following bug: The compression halts at an occurrance of ‘&&’ in the sourcefile.

    I don’t know whether it is because of the webpage or the servlet, but I figured you might be interested to know 😉

    Ciao,
    Bart

  2. Zhou Renjian says:

    Hi Bart,

    Thanks for pointing out the bug. It’s a bug of client side code.

    The client does not encode the JavaScript source before sending to server, so the server does not get the correct JavaScript source and won’t return correct compressed JavaScript.

    Now the bug is fixed.

  3. antimatter15 says:

    Is there anywhere I can find the source code of this?

  4. Gurman says:

    Took me time for you to read all of the reviews, but I in retliay enjoyed the piece. It proved to be very useful to me and Ia1afm certain to all the commenters here! Ita1afs always great when you are able to not only be informed, but also engaged! Ia1afm certain you had enjoyable writing this write-up.

  5. bape hoodie says:

    Radmanovic phrase Portland defeat The nuggets came away
    bape hoodie http://www.bapehoodie.com

  6. kyrie 2 says:

    Hamilton confirmed to attend the standing conference and media training
    kyrie 2 http://www.kyrie2.com

Leave a Reply

Your email address will not be published. Required fields are marked *