[sf-perl] making perl compile phase faster

Fred Moyer fred at redhotpenguin.com
Fri Apr 29 21:10:59 PDT 2011


>> On Fri, Apr 29, 2011 at 12:30 PM, Michael Friedman
>>> At my site, we run a lot of command-line perl scripts. Unfortunately, we
>>> also have 2794 perl modules.

On Fri, Apr 29, 2011 at 7:18 PM, Fred Moyer <fred at redhotpenguin.com> wrote:
> Or you can always use the gold standard, mod_perl.  Put your programs
> into handlers, and use LWP to run them.

You have a web application in the making here.  Pick a web standard to
migrate to (I recommend psgi as it runs under both Plack compatible
httpds and mod_perl2) and make the move.

If you have that many programs, and the startup time is that
pronounced, it is time to push this code into an intranet based
application.  Or webservice API - either way.  If your technical user
base is that large then an API allows them to access via language of
choice.  The point is that your code is complex enough now that you
need persistent interpreters around to service requests quickly.

>
> 2011/4/29 Christopher Taranto <christopher at tokpela.com>:
>> These look pretty old but maybe they are worth looking at.
>>
>> http://search.cpan.org/dist/PPerl/
>> http://daemoninc.com/PersistentPerl/
>>
>> On Fri, Apr 29, 2011 at 12:30 PM, Michael Friedman
>> <friedman at highwire.stanford.edu> wrote:
>>>
>>> I'm having a lucky day, so why not test it...
>>>
>>> At my site, we run a lot of command-line perl scripts. Unfortunately, we
>>> also have 2794 perl modules. Some of our scripts load up thousands of lines
>>> of perl code before they can do anything, even display a usage statement.
>>> Generally, from the time you hit <return> it's at least 5 seconds before
>>> anything happens, often longer, because perl has to load in all the required
>>> modules.
>>>
>>> At one point, I looked into using SelfLoader and making every method into
>>> an autoloaded method, but that failed on some of our important modules
>>> because they were not coded to be as... we'll go with "clean"... as I would
>>> like. And since we have thousands of modules, any solution has to be
>>> automated across nearly everything to work. I can't get in the way of the
>>> rest of the development team's work, even for a noticeable performance gain.
>>>
>>> So, let me ask y'all:
>>> 1. Is there anything approaching a "perl compiler" these days? (Something
>>> that does the compile stage early and lets you then just run the binary
>>> later.)
>>>
>>> 2. Is there a better option than SelfLoader now, for only compiling the
>>> methods that you are actually using instead of all of them? (As you would
>>> guess, a 1,000+ line perl module has a lot of things in it that you don't
>>> need for any one script.)
>>>
>>> 3. Are there ways of marking up methods so they don't get parsed and
>>> compiled until they're needed?
>>>
>>> Thanks for any advice, tips, or tricks!
>>> -- Mike
>>>
>>> PS - We aren't using Moose or anything like that. All the modules are
>>> hash-based, generic Perl objects and function libraries. If there's a class
>>> structure framework or something that could take care of this partial
>>> compilation for me, that'd work too.
>>>
>>> ______________________________________________________________________________
>>> Mike Friedman | HighWire Press, Stanford Univ |
>>> friedman at highwire.stanford.edu
>>>
>>> _______________________________________________
>>> SanFrancisco-pm mailing list
>>> SanFrancisco-pm at pm.org
>>> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>>
>>
>> _______________________________________________
>> SanFrancisco-pm mailing list
>> SanFrancisco-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>>
>>
>


More information about the SanFrancisco-pm mailing list