http://qs321.pair.com?node_id=57340

Masem has asked for the wisdom of the Perl Monks concerning the following question:

I'm in the process of redesigning/programming a web site of mine in order to take advantage of mod_perl and basically to clean up 3yr+ old kludges now that I know what I'm doing. I've got standard DBI through Mysql, and much of the functionality of the site is searching, producing the output listing, and go from there. Certainly close to a no-brainer.

Now, reading through a recent entry at perl.com on the new Template module, I got to thinking how I may be able to take advantage of this: I certainly could use the ability to use templates to produce various results of the DBI output that I'm getting. However, I'm concerned about speed -- with preliminary scripts running under a mod_perl-enabled virtual host of apache, I seem to be getting no speed benefit, yet. Mind you, two possible slow effects are occuring: I'm using fetchrow_hashref to get the values out from the DBI call, which might have some overhead, and after getting the row data, I do additional processing (more DBI or file reading) for supplimentary stuff. And furthermore, some of the formats for the Templates that I have planned will not use all this data. The data is simple rows, no complex data structures outside a few join'ed arrays.

In other words, I have a tradeoff between a concise and modular function that does the results display but runs slow, and to use several different functions for each list type but most likely a benefit in speed. I'd rather avoid the latter case, but I'm finding right now that even with queries of 5 results, the results take a long time to process. Is Template just not the right tool here, and should I fall back on just using something similar to here documents for each row?