1KB JavaScript Packer
[nfo]
|
||||||||
---|---|---|---|---|---|---|---|---|
|
||||||||
|
popularity : 56% |
|||||||
alltime top: #26640 |
|
|||||||
|
||||||||
added on the 2014-11-13 10:56:33 by whak |
popularity helper
comments
Great!
Would be great to see a benchmark, say, using the top 3 entries of the JS1k competitions, compared to other packers.
Please show the size of the original and final size.
Would be great to see a benchmark, say, using the top 3 entries of the JS1k competitions, compared to other packers.
Please show the size of the original and final size.
About the sizes, I meant the size of script before and after compression.
The main JS packers I have in mind are regPack, JS crush and First crush
I would be nice to see a benchmark with, say, the Top 3 entries of the last JS1k competitions, packed with these packers and yours, to get an idea of what kind of code they eat for breakfast.
The main JS packers I have in mind are regPack, JS crush and First crush
I would be nice to see a benchmark with, say, the Top 3 entries of the last JS1k competitions, packed with these packers and yours, to get an idea of what kind of code they eat for breakfast.
What I would find interesting: Are there any papers/info on what those JS crunchers do (besides minifying) and how they work, etc?
I have found for the few experiments and two crappy demos I produced is that it may not always be in your best interest to remove all repetition if you intend to pack it in to a PNG. The packing process means that sometimes if you have something that's necessarily five characters, for whatever reason, if you use those five characters a few other times your output size doesn't always increase appreciably. Certainly not as many times as it was used.
This is of course hard to account for because you can't* know exactly how it's going to treat your stuff, except by experimentation. I found a few things where I had a general pre-PNG size reduction but the PNG size went up by anywhere from parts of to several kilobytes.
* Well, if you knew the innards of the particular deflate implementation of the PNG writer you're using, then maybe ... but I wouldn't think it likely.
Maybe other people who write better web demos than I do have better reasons to use a tool than I do for not. My workflow just involved a cobbled together Java app that would take my code, write it to the PNG file with an .html extension, then append that project's bootstrap code to the end of the file. The tool works, but it doesn't cover for the fact that I write crappy demos. ;P
(Daeken of course took this to the extreme and even figured out what parts of a PNG can be overwritten with parts of his bootloader and still be loaded correctly by the browser to save on space. I understand the idea, but now how he did it. My attempts resulted in broken images that didn't load.)
This is of course hard to account for because you can't* know exactly how it's going to treat your stuff, except by experimentation. I found a few things where I had a general pre-PNG size reduction but the PNG size went up by anywhere from parts of to several kilobytes.
* Well, if you knew the innards of the particular deflate implementation of the PNG writer you're using, then maybe ... but I wouldn't think it likely.
Maybe other people who write better web demos than I do have better reasons to use a tool than I do for not. My workflow just involved a cobbled together Java app that would take my code, write it to the PNG file with an .html extension, then append that project's bootstrap code to the end of the file. The tool works, but it doesn't cover for the fact that I write crappy demos. ;P
(Daeken of course took this to the extreme and even figured out what parts of a PNG can be overwritten with parts of his bootloader and still be loaded correctly by the browser to save on space. I understand the idea, but now how he did it. My attempts resulted in broken images that didn't load.)
glad to see more js packers around, cool work. no rulez until it beats compression ratio of other packers though. ;)
submit changes
if this prod is a fake, some info is false or the download link is broken,
do not post about it in the comments, it will get lost.
instead, click here !
Anyhow...
In the screen shot you see 2 text boxes. Top is the original JavaScript source code & the bottom textarea is the generated packed script. This sample starts out with a 3,106 byte sample and packs it to 2,068 bytes. Not massive savings, but about 1/3 knocked off without any compression, isn't too bad.
My Google+: http://google.com/+DaveBrown