[Israel.pm] performance problems - Win32::Process which runs perl

Scott Weisman sweisman at pobox.com
Tue Sep 12 13:29:01 PDT 2006

Another thing you can do is to prevent the import() function from
being run when a module is loaded.

change this:

use My::Module;

to this:

use My::Module ();

For a large module, like Posix, the savings per invocation can be
impressive. However, functions will have to be explicitly invoked with
the full module path instead of just the sub name, if imported. A
small price to pay, and more clear code since the source of the
function call is more visible.


On 9/12/06, Gaal Yahas <gaal at forum2.org> wrote:
> On Tue, Sep 12, 2006 at 08:19:34PM +0300, Sagiv Barhoom wrote:
> > Any ideas how to improve performance ?
> The startup of a Perl program is slow because the program needs to be
> compiled. The more code, the slower the load. Shutdown isn't always
> slow, though: could it be that you have handles to resources open that
> need to be closed? If the delay is acute then maybe network handles are
> involved, but even just having a lot of objects that need to be
> destroyed can take time.
> One approach to treat your problem is not to spawn off external programs
> at all. This is what mod_perl technology famously does for CGI. This
> may not be suitable for you, since you say your code is generated; but
> depending on your problem, you may find it profitable to use closures
> and other functional techniques. Avoid string eval as much as possible,
> as this invokes the compiler at runtime.
> Of course, there are issues with doing this. Your current model assumes
> separate process spaces for each spawned process, and even if your tasks
> could be made to work together in one process, it could involve redesign
> and turn out new bugs because things need to learn to play together or
> because some per-process limit you were far away from is now reached.
> Probably the first thing you need to do is figure out where, exactly, is
> the time being spent during startup and shutdown. Is the module that you
> mentioned a particular one? Maybe it does stuff in BEGIN that is slow?
> When you exit, is there a point in the code you can stick the Win32
> equivalent of POSIX::_exit() and observe the speedup, then consider what
> you had chopped off.
> --
> Gaal Yahas <gaal at forum2.org>
> http://gaal.livejournal.com/
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl

Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote. - Benjamin Franklin

More information about the Perl mailing list