[Catalyst] Performance

Nilson Santos Figueiredo Junior acid06 at gmail.com
Fri Mar 9 03:02:30 GMT 2007


On 3/8/07, Jim Spath <jspath at pangeamedia.com> wrote:
> URI is next up at around 14% of time.  Is there anything that can be
> done about this one?

Wherever is reasonably possible, instead of actually using calls to
$c->uri_for() for every item, call it only once and then build the
rest of the URI manually.

This is specially useful on those tables where each line links to a
different item. Then, instead of something like:

  [% FOREACH item IN items %]
    [% c.uri_for('/item', item.id) %]
  [% END %]

Use something like:

  [% base_uri = c.uri_for('/item') %]
  [% FOREACH item IN items %]
    [% base_uri %]/[% item.id %]
  [% END %]

By making this kind of changes throughout an entire Catalyst
application I've been able to get 15-20% better performance.

-Nilson Santos F. Jr.



More information about the Catalyst mailing list