Speed Demons,

In the begining I had simple code, and it ran fast, and it was good. Then I changed my text file data to a SQLite database, mucked around for a while, created a lot of complicated code, and it all became slow. The code is a wiki/blog hybrid I have been writing for a while using the usual web-type modules (CGI::Simple, HTML::Template, DBD::SQLite, etc.)

I set up a home-grown profiling system using Time::HiRes and gettimeofday and tv_interval. I wrapped every sub in my $start_time, $end_time, and tv_interval($start_time, $end_time) "debugger" and got some indication of where relative time was going. However, the total time taken for the script to do its work is of course way more than what my debugger reports. I did mention, it is a home-grown debugger.

So, I decided to go the pro way and called on Devel::Profiler. I got the tmon.out alright, but dprofpp quits with the infamous Garbled profile, missing an enter time stamp at /usr/bin/dprofpp line 792, <fh> line 518.

504: & 57 DBD::_::st fetchall_arrayref 505: * 57 506: + 28 507: @ 0 0 1 508: * 29 509: * 22 510: - 22 511: * 30 512: - 30 513: @ 0 0 1 514: - 57 515: + 31 516: - 31 517: @ 0 0 1 518: - 55

Seems like another monk had a similar problem, and, like mine, it was also related to DBD calls. Unfortunately, that thread led to no resolution.

So... what do I do next? I ask both for help with profiling my code, as well as possible improvements to it by way of possible gotchas that could be slowing it down. I know I haven't provided the code here, but I am really looking for the "usual suspects" that I should look for. As I said, the web-server is not a problem -- it is just my localhost, and serves up other sites of mine quite briskly.

--

when small people start casting long shadows, it is time to go to bed

In reply to Finding bottlenecks in the code by punkish

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.