Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options


by santhosh_89 (Scribe)
on Oct 29, 2009 at 05:35 UTC ( #803886=perlquestion: print w/replies, xml ) Need Help??
santhosh_89 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

I have a module called USER_DBI,It would be included following modules.

package USER_DBI; use USER_DBI_Global; # 15 Lines code BEGIN{ unshift(@INC, $USER_DBI_Global::INI_Module); } use Config::Abstract::Ini; ### CPAN Module use Switch; ### CPAN use USER_DBI_Parser; ### 1 sec 400 lines code use USER_DBI_Lib; ### 2 sec 500 lines code use USER_DBI_Log; ### 1 sec 400 Lines code use USER_DBI_Database; ### 1 sec 300 lines code

While including the USER_DBI module,It is taking 4 sec to load those modules,I checked by benchmark module to get to know the load time.I wanted to use effective method can anyone help me.
Note: Every Module has required functionality.Reducing the code size is not possible.Already it has optimized.

Replies are listed 'Best First'.
Re: Module load time issue
by FalseVinylShrub (Chaplain) on Oct 29, 2009 at 06:23 UTC

    That seems like rather a long time to load modules of this size. Are the modules doing anything other than defining subroutines? e.g. attempting to connect to a server, code generation or something.

    Have you tried benchmarking what happens within the modules at load time? It sounds like more is happening than just loading some code.

    HTH, F.V.S.

    update: unshouted the title

by cdarke (Prior) on Oct 29, 2009 at 08:30 UTC
    First, Switch is deprecated and should not be used, although your numbers imply this is not the issue.

    Find out what your USER_DBI modules are doing at compile time: the number of lines of code is a poor indication. They might, for example, connect to a database in a BEGIN block and wait for a DB service to respond. They might be connecting to another machine through a socket; they might be calculating the number of molecules in the universe in a BEGIN block for all I know. There are several other blocks that get executed at module load time as well, and they could be using any or all of them.
by Anonymous Monk on Oct 29, 2009 at 05:51 UTC
    Already it has optimized.

    You're using a source filter, so how is that possible?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://803886]
Approved by ikegami
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2017-06-25 13:24 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (567 votes). Check out past polls.