Profiling in Template Toolkit
The Template Toolkit does not support any profiling tools “out of the box.” However, that didn’t stop Randal from getting the numbers — and the performance boost — he needed.
Tuesday, November 15th, 2005
Over the past year or so, I’ve talked a lot about Andy Wardley’s Template Toolkit (TT, http://http://www.template-toolkit.org/), because I’ve been using the software extensively to build a number of significant web sites. Of course, “build” means “solving problems,” or scratching my head until that precious “aha! ” moment comes along.
For example, I recently completed the features of a deliverable web site, but as the customer started playing with it, one of his first comments was, “This part is too slow, and I spend all my time on this screen.” That wasn’t a show-stopper, though, because I’d deliberately chosen to program the application with flexibility and ease-of-implementation first, knowing that I’d need to make a performance pass later to optimize anything that was too slow. (Avoid the perils of premature optimization, or making decisions about performance before actually understanding where the bottlenecks are.)
“No problem”, I said, “because I’ll just trot out Devel::DProf to find the hot spots and slow spots and optimize those.” But, alas, adding Devel::DProf caused the program to dump core. Ugh. Even moving the code to a different architecture (from my Mac OS X development platform to the OpenBSD deployment platform) proved to be fruitless.
This wasn’t looking good — for the application or my income.