On Fri, Jun 11, 2010 at 9:30 AM, Xaero <groundxa...@gmail.com> wrote:
> I was wondering if there was any other way to compress exe's genereated by PAR

First of all, if you're generating an exe then we are talking about
PAR::Packer, not PAR.
An exe - as generated by pp - consists actually of a fixed part (i.e.
it's the same for any exe)
which is kind of  "self extracting". The second part is a .par
(generated by PAR)
- it's actually a standard zip file. It contains your script and (most
of) the Perl modules
used by it (transitively).

I think compression of the second part is fairly good, other compressors
have other tradeoffs, e.g. slightly better compression, but slower
extraction speed.
Also there is no other widely supported "compressed archive" standard other than
zip archives. By "compressed archive" I mean that you can extract
inidividual members
_without_ having to uncompress the whole shebang (a gzipped tarball is a
counterexample).

Now for the first part: it contains some core Perl modules
(essentially PAR and its
dependencies like Archive::Zip), a custom Perl interpreter and the
shared libperl.dll
(or such) that the interpreter is linked against. Neither of this
three parts is currently
compressed in any way. On Windows we're talking ~1.5 MB here, mostly for the
perl interpreter and the libperl.dll. Steffen and I independently did
some experiments
that show that one can roughly half the size by simply storing it
zipped (using zlib).
Of course the self extractor would need to link in statically the
uncompress methods
from zlib, that would add ~40 KB (on Windows) to the self extractor, so this
would be definitely a win.

I have some experimental patches that can build the "self extractor" wit this
modification and have it produce the same stuff as the current version.
Since we can't count on that a static libz is available on the
platform where you
install PAR::Packer and pp (esp. on Windows), we need to

- bundle the zlib source with PAR::Packer

- modify PAR::Packer's build system to build a static zlib (if necessary) from
  these sources

The latter has absolutely nothing to do with Perl, so we can't expect
any help from
Perl's module build system (i.e. ExtUtils::MakeMaker) for it. Fortunately,
Compress::Raw::Zlib seems to have succeeded in doing this, so we might
just steal their solution. But it's still the part that will consume
the most tuits,
so don't hold your breadth.

> I've tried testing the -z option but it looks like it make very little 
> difference but the exe I'm testing it on is generated by pp -e "print 
> q(hello!!)" command. Which makes me wonder if the -z switch only affect the 
> .par part and not the entire exe?

Correct,  -z only affects the .par part which is rather small for the
"hello world" example :)
In general, the gain from -z 9 vs -z 6 (the default) is marginal.

Cheers, Roderich

Reply via email to