We have a large app using Class::DBI that runs too slowly for our needs on large files. To understand where the program is spending its time, we ran a small file through the system with profiling on and then ran dprofpp. Here's what dprofpp says:
Exporter::export_ok_tags has -1 unstacked calls in outer Exporter::Heavy::heavy_export has 26 unstacked calls in outer Class::MethodMaker::_make_get_set has 1 unstacked calls in outer Exporter::Heavy::heavy_export_tags has 1 unstacked calls in outer Exporter::export_tags has -1 unstacked calls in outer Class::MethodMaker::get_set has 1 unstacked calls in outer AutoLoader::AUTOLOAD has -2 unstacked calls in outer Exporter::Heavy::heavy_export_ok_tags has 1 unstacked calls in outer Exporter::export has -26 unstacked calls in outer Total Elapsed Time = 2.623325 Seconds User+System Time = 1.972325 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 25.3 0.499 1.086 41957 0.0000 0.0000 Class::DBI::Column::name_ +lc 15.2 0.300 1.944 45850 0.0000 0.0000 Class::Accessor::__ANON__ 15.1 0.298 0.298 43063 0.0000 0.0000 Class::Accessor::get 14.1 0.279 1.060 286 0.0010 0.0037 Class::DBI::_require_clas +s 11.3 0.224 1.232 7695 0.0000 0.0002 Class::DBI::__ANON__ 10.9 0.216 1.261 40851 0.0000 0.0000 Class::DBI::Column::__ANO +N__ 9.58 0.189 0.430 11896 0.0000 0.0000 Class::DBI::_attr 9.48 0.187 0.186 22899 0.0000 0.0000 Class::Data::Inheritable: +:__ANON__ 7.00 0.138 0.200 6934 0.0000 0.0000 Class::DBI::primary_colum +n 6.34 0.125 0.380 118 0.0011 0.0032 Class::DBI::_mk_column_ac +cessors 5.53 0.109 0.349 89 0.0012 0.0039 base::import 5.48 0.108 0.416 5572 0.0000 0.0001 Class::DBI::_attribute_se +t 5.43 0.107 0.107 1334 0.0001 0.0001 UNIVERSAL::can 4.77 0.094 0.094 11 0.0085 0.0085 Template::Parser::BEGIN 4.06 0.080 0.203 7 0.0114 0.0290 Template::Config::load
To our understanding, this output says most of the time is spent on CDBI accessors. Not suprising.

We are comitted to using CDBI.... So what do we do next to gain speed? Perhaps we're using CDBI in a not-so-smart way... what else could we be asking dprofpp to know where to start tuning?

water

update

As per perrin's suggestion, used the -r flag:

dprofpp -r > out.txt
and get the following output
Total Elapsed Time = 2.585098 Seconds Real Time = 2.585098 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 20.3 0.526 1.096 41957 0.0000 0.0000 Class::DBI::Column::name_ +lc 12.8 0.331 0.331 43063 0.0000 0.0000 Class::Accessor::get 11.9 0.309 0.309 635 0.0005 0.0005 DBI::db::ping 10.7 0.279 1.053 286 0.0010 0.0037 Class::DBI::_require_clas +s 10.1 0.261 0.501 557 0.0005 0.0009 DBI::st::execute 9.09 0.235 2.188 45850 0.0000 0.0000 Class::Accessor::__ANON__ 8.63 0.223 1.228 7695 0.0000 0.0002 Class::DBI::__ANON__ 7.97 0.206 0.461 11896 0.0000 0.0000 Class::DBI::_attr 7.85 0.203 0.201 22899 0.0000 0.0000 Class::Data::Inheritable: +:__ANON__ 7.27 0.188 0.188 79 0.0024 0.0024 DBI::db::commit 6.34 0.164 1.220 40851 0.0000 0.0000 Class::DBI::Column::__ANO +N__ 4.18 0.108 0.374 118 0.0009 0.0032 Class::DBI::_mk_column_ac +cessors 4.18 0.108 0.323 6211 0.0000 0.0001 Class::DBI::_attribute_ex +ists 4.18 0.108 0.348 89 0.0012 0.0039 base::import 4.06 0.105 0.184 6934 0.0000 0.0000 Class::DBI::primary_colum +n

In reply to dprofpp -- now what? by water

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.