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.
In reply to Finding bottlenecks in the code by punkish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |