I have about ten routines that are common to a number of classes. These routines are kept in a package called Func. After profiling an application with DProf, I was surprised to find that most of the time is being spent in the BEGIN section of Func.
Here is the output from the profiler:
Total Elapsed Time = -36.6621 Seconds
User+System Time = 86.44528 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c Name
28.4 24.62 28.883 738874 0.0000 0.0000 SE::Util::Func::BEGIN
Here is the top of the Func module:
package SE::Util::Func;
use Exporter;
@ISA = ('Exporter');
@EXPORT= qw( SE_cat SE_dump SE_getName SE_getValue SE_isTag SE_matchN
+ame SE_matchNamePattern SE_prog SE_trim );
require 5.6.1;
use strict;
Why is perl spending so much time in the BEGIN section of Func?
Thanks.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|