Hi,

 

I am new to Template::Toolkit, and I am hoping to integrate it into my company’s high-traffic e-commerce site (as part of a Catalyst application running on mod_perl 1.29).  I have written a small sample app in our development environment to see how Catalyst performs.  I am in the process of examining the running app via the perl-status utility in mod_perl, and I am finding that the most memory intensive functions are part of the Template::Toolkit suite.

 

Here are some snippets from various memory views in perl-status.

 

Template::Timer::process: 183780

Template::Service::process: 194319

Template::Context::process: 196594

 

Template::Timer looks like a debugging mechanism, so I’m guessing that it can be turned off when the production application is deployed.  However, the other two process() functions are large.  On drilling down into them via perl-status, I found that this is because they contain large entries in something called the PADLIST summary (not sure exactly what this means).  For instance, here is a reporting of what appears to be a large scalar value that is “stuck” in the process.

 

19:    $output [PV   89642 bytes] 

 

Upon investigating the Template::Context::process code, I found that $output contains the interpolated version of the template, and is returned to the caller.

 

So here are my questions.

 

- Will the size of the process() methods continue to grow as the number of calls to them increases? I’m asking irrespective of the size of the template being rendered.  Basically, how well does process() manage its memory?  Is there a way to trim this down?

 

- I noticed that the process() method returns $output as a scalar value, as opposed to as a scalar reference.  Won’t this copy the entire contents of the variable to its caller of process() (a potentially inefficient action for large $output values)?  Can I set things up so that a reference to the rendered template gets passed around instead?  Are there specific reasons things are set up the way they are?

 

- What are the best ways to make the Template::Toolkit as efficient as possible?

 

Thanks so much for your help.

 

- Simon

-----------------------------------------------

Simon Miner

Applications Engineer

Christianbook.com

E: [EMAIL PROTECTED]

T: (978) 573-2233

F: (978) 573-8233

-----------------------------------------------

 

Reply via email to