gaal has asked for the wisdom of the Perl Monks concerning the following question:

Recently I suggested using miniperl instead of the regular perl in a tight environment. Then I decided I'd better check exactly how much better this perl was in terms of disk space, and how much worse it was in terms of functionality. I was surprised by the answer to my first question:
% ls -l miniperl perl -rwxr-xr-x 1 root root 150137 May 26 15:43 miniperl -rwxr-xr-x 1 root root 59507 May 26 15:43 perl
That is, the full-featured perl is smaller by almost 90k than something that was supposed to be a tighter version?

Of course, I said, miniperl's probably statically linked so the executable must be self-contained, but doesn't require libperl, right? Wrong, it turns out: ldd shows the two depend on the same libraries, so miniperl isn't so mini. What gives?

(All this is on Linux.)

Replies are listed 'Best First'.
Re: miniperl larger than perl?
by Joost (Canon) on Jul 27, 2004 at 14:33 UTC
    On my system perl is slightly bigger than miniperl:
    $ ls -la miniperl perl -rwxr-xr-x 1 joost joost 1096819 Jul 21 13:39 miniperl -rwxr-xr-x 1 joost joost 1187556 Jul 21 13:40 perl
    The only difference between miniperl and perl is that miniperl cannot load XS-based perl modules as shared objects (that is, it doesn't support DynaLoader).

    Miniperl was never intended to be smaller than perl, it's just perl without Dynaloader, so that it can be put in charge of translating and compiling the Dynaloader XS code.

    The same is true for microperl, too, only microperl is supposed to one day replace the shell scripting in Configure.

    Also, dependencies on XS based shared libraries will not show up using ldd because those libraries are loaded dynamically when needed, so the difference might come from there. update: This can't explain the difference: miniperl can't be linked with XS code, because there is no program to translate XS code at the time miniperl is built.

Re: miniperl larger than perl?
by eserte (Deacon) on Jul 27, 2004 at 14:14 UTC
    On this system, it looks like it should (after stripping the binaries, non-shared build):
    -rwxrwxr-x 1 eserte eserte 1155532 Jul 27 16:13 miniperl* -rwxrwxr-x 1 eserte eserte 1237504 Jul 27 16:13 perl*
    miniperl is not supposed to be that mini. It's just perl without DynaLoader compiled in.

    (Numbers with RedHat 8.0 and perl 5.9.something)

Re: miniperl larger than perl?
by Courage (Parson) on Jul 27, 2004 at 15:25 UTC
    You may consider "miniperl" being mini from different point of view: it has minimal features but not quality of compiled C code.

    Namely, it does not have -DMULTIPLICITY, it could have no PerlIO (dont know how it is in 5.8.x but 5.6.x certainly had no PerlIO inside miniperl)

    As a side note, in MSWin32 it appears that perl.exe is really small: 41k and perl58.dll is 798k, yet miniperl.exe is about 700k

    Courage, the Cowardly Dog

Re: miniperl larger than perl?
by BUU (Prior) on Jul 27, 2004 at 18:51 UTC
      Looking at that site for the second time, I can't help but think that it is in violation of the perl licence, specifically, it says this:
      Copyright & Licence Copyright (C) 2003 Graciliano M. P. <gm[at]virtuasites.com.br> This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
      Whilst at the same time offering the binaries without offering source-code.

      To explain: the perl licence offers the recipient the choice between GPL or artistic licence, or both, but the GPL licence REQUIRES the sourcecode to be either distributed with the binaries, or offered for a nominal copying fee to anyone recieving the binaries.

      update: I should explain that the offer for source code should be a written offer accompanying the binaries, according to the GPL.

        Take a look in the module LibZip. This is the source/generator of TinyPerl.

        Graciliano M. P.
        "Creativity is the expression of the liberty".

        You misinterpret the choice, in such a way as there is no choice.

        As a redistributor, you have the choice of what license you want to distribute under. You can choose the Artistic License, which lets you distribute modified binaries without source, so long as you "give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version." (4c)


        Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Re: miniperl larger than perl?
by bart (Canon) on Jul 27, 2004 at 20:08 UTC
    perl, 60k? That ain't right... On my Linux, perl is close to 800k.

    The DLL on Windows is around 600k. perl.exe is nothing but a bootstrapper which loads the DLL... Are you sure this isn't something similar you're looking at here?

      Sure it is, but both my miniperl and the usual one were using the very same DLLs, yet the miniperl bootstrapper was larger.
Re: miniperl larger than perl?
by xorl (Deacon) on Jul 27, 2004 at 20:27 UTC
    ls -lh perl -rwxr-xr-x 2 root root 12K Aug 13 2003 perl Why are y'all's so much bigger?? Have I done something wrong?
Re: miniperl larger than perl?
by msemtd (Scribe) on Jul 27, 2004 at 14:11 UTC
    I'm unfamiliar with miniperl but I expect it has some modules linked-in.
Re: miniperl larger than perl?
by ysth (Canon) on Jul 28, 2004 at 08:17 UTC
    Are you certain miniperl has a dependency on libperl.so? On cygwin, perl.exe does load the dll (cygperl5_8_5.dll) and miniperl.exe does not.
      That's what ldd says, FWIW. perl-5.8.4 on linux using more or less exactly the default Debian config settings.