punkish has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Finding bottlenecks in the code
by BrowserUk (Patriarch) on Jun 12, 2005 at 15:47 UTC | |
by punkish (Priest) on Jun 12, 2005 at 16:36 UTC | |
by BrowserUk (Patriarch) on Jun 12, 2005 at 18:23 UTC | |
|
Re: Finding bottlenecks in the code
by davidrw (Prior) on Jun 12, 2005 at 15:34 UTC | |
by punkish (Priest) on Jun 12, 2005 at 16:27 UTC | |
by davidrw (Prior) on Jun 12, 2005 at 16:59 UTC | |
|
Re: Finding bottlenecks in the code
by dragonchild (Archbishop) on Jun 12, 2005 at 21:07 UTC | |
|
Re: Finding bottlenecks in the code
by TedPride (Priest) on Jun 12, 2005 at 20:42 UTC | |
|
Re: Finding bottlenecks in the code
by punkish (Priest) on Jun 13, 2005 at 04:45 UTC |