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

How should one interpret the fact that the DProf shows BEGIN blocks for one or more modules of code as using a significant percentage of execution time? (When no actual BEGIN block is declared in the code itself.)

I guess that the BEGIN block in this case is for compilation, memory allocation and so on?

Replies are listed 'Best First'.
Re: BEGIN blocks when profiling
by polettix (Vicar) on Sep 05, 2005 at 16:40 UTC
    use statements induce BEGIN blocks. You're probably using many modules and you're paying for their initialisation. If you want to defer these operations consider using require at the right point of your code.

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.
Re: BEGIN blocks when profiling
by ysth (Canon) on Sep 05, 2005 at 18:44 UTC
    Don't forget no.