[Catalyst] TT macro to avoid excessive $c->uri_for calls

2007-08-07 Thread Tobias Kremer
I'm wondering if it has any bad side effects to have a TT macro which is set to
$c->uri_for. If I'm remembering previous posts on this topic correctly, calling
uri_for() repeatedly has quite a big impact on performance which really matters
most for my current application. I have this in a global macros.tt2 file:

[%
base = Catalyst.req.base;
static = Catalyst.config.hosts.static;
images = Catalyst.config.hosts.images;
site.url = {
base= base
static  = static
images  = images
}
-%]

That way I can easily change the location of my static files and images to
another server or place using the Catalyst config file and generate links like
this:


bla

etc.

Any comments? Thanks!

--Tobias

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] TT macro to avoid excessive $c->uri_for calls

2007-08-07 Thread Matt S Trout
On Tue, Aug 07, 2007 at 09:43:30AM +0200, Tobias Kremer wrote:
> I'm wondering if it has any bad side effects to have a TT macro which is set 
> to
> $c->uri_for. If I'm remembering previous posts on this topic correctly, 
> calling
> uri_for() repeatedly has quite a big impact on performance which really 
> matters
> most for my current application. I have this in a global macros.tt2 file:

That's why we optimised the living crap out of uri_for.

It's more than 10x faster than it used to be.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] TT macro to avoid excessive $c->uri_for calls

2007-08-07 Thread Zbigniew Lukasiak
On 8/7/07, Matt S Trout <[EMAIL PROTECTED]> wrote:
> That's why we optimised the living crap out of uri_for.
>
> It's more than 10x faster than it used to be.

Great to hear that.  Does it also apply to uri_with?

-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] TT macro to avoid excessive $c->uri_for calls

2007-08-07 Thread Matt S Trout
On Tue, Aug 07, 2007 at 01:10:09PM +, Zbigniew Lukasiak wrote:
> On 8/7/07, Matt S Trout <[EMAIL PROTECTED]> wrote:
> > That's why we optimised the living crap out of uri_for.
> >
> > It's more than 10x faster than it used to be.
> 
> Great to hear that.  Does it also apply to uri_with?

Nobody ever reported that as a bottleneck, and it's a much simpler code
path already.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/