Hi all,

Steffen Mueller via RT wrote:
 Except that
statically linking a libz for some minor compression and reduction of the executable file size would be really cool. Not saying *you* should do that, mind you.

I thought about this some more and did some experimenting.

a) par.pl can't be (simply) compressed because its string is used in the signature generation, it seems.

b) Just compressing libperl roughly halves the size of the resulting Hello World executable.

We could save even more if we had to include another library (cf. the recent bug report).

In my experiment, I got as far as finding the right libz options for static and dynamic linking, telling file2c to do compression, compressing the output in file2c using Compress::Zlib, and marking the binary blob in the resulting C code as compressed.

I just read up on the zlib C interface and while it's conceptually the same as Compress::Zlib (surprise), it shows that C is a horrible language and my C even more so. That is to say it's too annoying to serve as a distraction from more important work, so I'll punt for now.

I guess the only difficult part that remains to be done is to modify the WRITE_* macros that are generated by file2c so that they take into account the compression. This seems difficult only because of the obscure "chunk" logic.

If anybody else would like to get a copy of my changes, let me know. I simply didn't commit them in a branch since they're really quite hackish.

Cheers,
Steffen

Reply via email to