Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Using Modules Limit?

by bladx (Chaplain)
on Mar 19, 2007 at 05:30 UTC ( #605424=perlquestion: print w/ replies, xml ) Need Help??
bladx has asked for the wisdom of the Perl Monks concerning the following question:

(XP is just a number.)

These are probably tired questions, but I searched around the Monastery first and couldn't seem to find an answer.

Is there a limit to the number of Perl modules one can use in a Perl script?
If one uses a lot of modules, does that slow a script down when it is run?
(I'd guess it probably depends on what module one is using... but I thought I'd ask.)

I've taken a break away from Perl since... I'm not sure, maybe 2002 or earlier. And back then, I was just getting started with learning how to even think about programming. Thanks.

Andy

Comment on Using Modules Limit?
Re: Using Modules Limit?
by Zaxo (Archbishop) on Mar 19, 2007 at 05:44 UTC
    Is there a limit to the number of Perl modules one can use in a Perl script?

    That's limited, in practical terms, only by the amount of memory you want to use. Perl imposes no hard limit.

    If one uses a lot of modules, does that slow a script down when it is run?

    Not under most circumstances. The factorization and compartmentation modules encourage is likely to improve overall efficiency. There is some time overhead on sub calls, and using lots of memory can bring a script to its knees.

    After Compline,
    Zaxo

      Thanks for the info!

      Andy
Re: Using Modules Limit?
by Sixtease (Friar) on Mar 19, 2007 at 07:44 UTC
    I've taken a break away from Perl since... I'm not sure, maybe 2002 or earlier. And back then

    This should come from someone who was here in 2002 but... Welcome back friend! *offers embracement*

Re: Using Modules Limit?
by CountZero (Bishop) on Mar 19, 2007 at 10:36 UTC
    If one uses a lot of modules, does that slow a script down when it is run?
    That is an interesting question and the answer is a definite "yes and no".

    Provided you do not go totally overboard with adding modules and do not exhaust your computer's memory so it starts swapping memory to disk, adding modules will have little effect once your program has started running. On the other hand, the loading from disk and subsequent compiling of a lot of modules can take some time, but this is normally a "one time penalty" only, although you will suffer it every time you run the program, hence the benefit of having persistent perl-frameworks such as mod_perl in a web-server environment.

    If the compiling takes a long time, perhaps you can have a look at Module::Compile which provides for loading of pre-compiled modules in .pmc format. I have not yet used it, so YMMV.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://605424]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2014-07-31 10:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (248 votes), past polls