in reply to Why can code be so slow?
use mod_perl;
Probably the biggest hit you're getting is the overhead of the CPAN modules. The Template and DB abstraction layer / rdbms systems are all huge. File::Find is similarly big . You'll get a giant speedup from caching those into memory under some sort of persistent environment.
When you get to production, Apache is also pretty slow/bad. There are far more efficient options now.
My best advice would be to install nginx on port 80 to handle static content, and proxy all dynamic content to your mod_perl app on an alternate port.
Run mod_perl2 + Apache2 on port 8000. Use the registry module on mp2, not the mod_perl handler module -- you should have a fairly transparent migration.
Don't expect to get 16x more performace off mod_perl -- mp will speed you up, but you're still going to suffer from performance bottlenecks at the db level.
Stroring data in xml is a bad decision. You should store it in the DB in some sort of normalized format, then export it to xml or whatever you want as you need it. you're probably doing a lot more parsing and using a lot more diskspace than you should.