in reply to Re: My CGI is slow, but I don't think it's my fault.
in thread My CGI is slow, but I don't think it's my fault.

And Perrin gets the gold star. Right on both counts.

Re-profiling with dprofpp -r (d'oh. There's an option which I'll need to remember) yielded:

Total Elapsed Time = 22.28669 Seconds Real Time = 22.28669 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 59.2 13.20 13.200 314 0.0420 0.0420 DBI::db::ping

Basically, every time it tried to grab a cached database handle, it would ping it first to make sure it was still valid. Useful in persistent environments (mod_perl, etc.) or long running scripts, but not so much on a website that's all CGI and nothing survives long. I figured I could take the risk of having the database handle vanish in that time, so I shut off the constant re-pinging.

Next profile dropped the total run time down to 5.45 seconds, with 83% of my time spent executing queries. Much more reasonable. And I'm sure I can get that runtime down even farther with some judicious indexing.

Thanks!