[Catalyst] Catalyst Performance issues

Perrin Harkins perrin at elem.com
Sat Oct 7 19:53:04 CEST 2006


Nilson Santos Figueiredo Junior wrote:
> Manually running and timing the queries as output when DBIC_TRACE=1.
> 
> Switching from running a "$rs->next" loop inside TT to loading the
> objects inside the controller (through $rs->all). Then I tried using
> $rs->all inside the template and noticed the time spent in the
> controller going down and the spent in the end action going up by
> approximately the same amount as I've timed when manually running the
> queries.

That all makes sense.  I like to use the DBI profiler for this because 
it tells you if many calls to some small method are adding up.

> The template cache gives me a performance boost varying from almost 0%
> to 10% (average 3%).

What are you changing here?  Normally this makes a huge difference, but 
Catalyst generally does the right thing for TT caching, so you probably 
had it on already.

> I'll take a look into using constants, I never
> knew TT had them.

http://www.template-toolkit.org/docs/default/Manual/Variables.html#Compile_Time_Constant_Folding

>> Does your template do anything that might cause DBIC to fetch more data?
> 
> Some of them, yes.
> The ones in question, no - they prefetch everything they need (at
> least according to DBIC_TRACE there's nothing missing and only one
> query is issued).

Well, that's a shame, since that was your most likely culprit and the 
easiest to fix.

Not to be a pest, but I still think you should try dprofpp with -r.  TT 
often shows up on top of CPU lists but hardly ever on real time.  It may 
be that the actual time is mostly being spent in the accessor methods 
that TT is calling on your objects, rather than in the TT get method.

- Perrin



More information about the Catalyst mailing list