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

The Perl FAQ page states the following:


"If you're currently linking your perl executable to a
shared libc.so, you can often gain a 10-25% performance
benefit by rebuilding it to link with a static libc.a
instead. This will make a bigger perl executable, but your
Perl programs (and programmers) may thank you for it. See
the INSTALL file in the source distribution for more
information."

Is this really recommended? Is the performance gain only
seen in cases where a script is invoked many times (CGI)
or would it also benefit a long running perl process?

Replies are listed 'Best First'.
Re: Static Perl
by Joost (Canon) on Mar 19, 2008 at 01:08 UTC
    Is this really recommended?
    I'm not sure. I think if you really want to improve perl loading performance, you'd just set the sticky bit on the perl executable.

    In any case, I don't think it would matter for any situation where you're not exec()ing many perl interpreters a second, and some kind of persistent server solution - like mod_perl, fastcgi or a pure-perl server - would be much faster than anything this trick would offer.

      I think if you really want to improve perl loading performance, you'd just set the sticky bit on the perl executable.

      Does the sticky bit still work in this way anywhere? According to Wikipedia it seems to be ignored (or used to do completely different things) on most operating systems (they mention that HP-UX supports it).

Re: Static Perl
by locked_user sundialsvc4 (Abbot) on Mar 19, 2008 at 12:58 UTC

    I honestly don't know how current or relevant that admonition may be. My understanding, too, is that the “sticky bit” is an anachronism now.

    My experience has been that most operating systems these days are very good at caching file-buffers on their own. So the first time you run a program, it takes a little longer than it does for the rest of the day. But if you run a bunch of other things in the meantime, it takes a little longer again.

    So, maybe the best thing to do for you is to just experiment. Try it both ways. And of course, “if it's not really hurting now, don't bother.”