Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I am currently doing some performance tuning and have a question regarding the output of Dprofpp. I am seeing that the majority of time (40% or more) is being taken up with many thousands of calls to main::BEGIN.

The typical output that I'm getting looks like this:

> dprofpp Total Elapsed Time = -51.0824 Seconds User+System Time = 310.7123 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 44.8 139.2 114.05 843865 0.0000 0.0000 main::BEGIN 31.3 97.53 97.452 36407 0.0027 0.0027 DBI::st::execute 22.4 69.62 183.55 4 17.405 45.889 main::ScanBuffer Snip...

I had a super search and a look on CPAN. I found the following useful:

  • The CPAN documentation at Devel::DProf
  • Wierd dprofpp results. by dreadpiratepeter
  • The followup by dug seems to indicate that Dprof may be lying but... is it?
  • With Why is perl spending so much time in the BEGIN section? by erabus I thought I had cracked it but... I'm not sure that really answers it. I do not have a BEGIN {} block in my script.
  • One further thing that might be useful are the modules that I'm using:

    use strict; use DBI qw(:sql_types); use Data::Dumper;

    ... I mention this as I think the BEGIN block is called by AUTOLOADER when use-ing modules but I'm afraid that I'm not very clear on the details. One thought that I had was that Dprof was counting the BEGIN blocks in the imported modules but not labelling them correctly in the output. Plausible or not?


    In reply to Dprof and main::BEGIN by dbush

    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post; it's "PerlMonks-approved HTML":

    • 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 or How to display code and escape characters are good places to start.
    Log In?

    What's my password?
    Create A New User
    Domain Nodelet?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (2)
    As of 2022-05-20 18:01 GMT
    Find Nodes?
      Voting Booth?
      Do you prefer to work remotely?

      Results (75 votes). Check out past polls.