Re: [Templates] TT in callback

[prev] [thread] [next] [Date index for 2005/01/05]

From: Andy Wardley
Subject: Re: [Templates] TT in callback
Date: 11:26 on 05 Jan 2005
Perrin Harkins wrote:
> It would work fine, but there is a performance penalty for using INCLUDE
> which many people are not aware of.  INCLUDE makes a complete copy of
> the Stash in order to give the included template a private copy of the
> data.  Most people don't need this, so INCLUDE is just wasting time and
> they should be using PROCESS.

That's another item from the "seemed like a great idea at the time" list 
that is fixed in TT3.   :-)

Rather than copying the entire variable stash each time we need to 
create a localised variable scope (e.g. INCLUDE), TT3 creates a new, 
empty variable stash with a parent link pointing upwards to the stash 
of the calling context.  

When a variable is first accessed, the stash fetches it from a parent, 
grandparent, great-grandparent, etc., walking up through the ancestral 
family tree until the variable is located.  It then copies it into the 
current local stash, effectively caching it for any subsequents access.  
Any new variable values are written into the local stash, leaving any 
previous values untouched in the parent, grandparent, etc.  At the end 
of the template, the local stash is throw away and we revert to the 
parent stash.

The same localisation mechanism is employed for all resources addressable
by TT3: variables, templates, plugins, filters, and any other custom 
resources you might like to add.  This has been unified in the all-new
singing and dancing Template::Context object, although I'm still in 
the process of unifying some of these parts right now, so the architecture
is fluxating somewhat.  

Cheers
A


_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

(message missing)

[Templates] TT in callback
Arshavir Grigorian 19:13 on 03 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 21:14 on 03 Jan 2005

Re: [Templates] TT in callback
Arshavir Grigorian 21:55 on 03 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 22:02 on 03 Jan 2005

Re: [Templates] TT in callback
Arshavir Grigorian 22:39 on 03 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 23:21 on 03 Jan 2005

Re: [Templates] TT in callback
Michael Peters 14:21 on 04 Jan 2005

Re: [Templates] TT in callback
Sean T Allen 14:46 on 04 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 15:48 on 04 Jan 2005

Re: [Templates] TT in callback
Andy Wardley 11:26 on 05 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 15:18 on 05 Jan 2005

Re: [Templates] TT in callback
Andy Wardley 11:08 on 06 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 19:34 on 06 Jan 2005

Re: [Templates] TT in callback
Harry Jackson 10:39 on 07 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 14:02 on 07 Jan 2005

Re: [Templates] TT in callback
Bill Moseley 16:11 on 07 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 16:23 on 07 Jan 2005

Re: [Templates] TT in callback
Bill Moseley 19:22 on 08 Jan 2005

Re: [Templates] TT in callback
C. Chad Wallace 18:05 on 07 Jan 2005

Re: [Templates] TT in callback
Tony Bowden 00:14 on 04 Jan 2005

Re: [Templates] TT in callback
Cees Hek 02:38 on 04 Jan 2005

Re: [Templates] TT in callback
merlyn (Randal L. Schwartz) 02:48 on 04 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 19:55 on 04 Jan 2005

Re: [Templates] TT in callback
Cees Hek 22:18 on 04 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 23:54 on 04 Jan 2005

Re: [Templates] TT in callback
Cees Hek 02:39 on 05 Jan 2005

Re: [Templates] TT in callback
Andy Wardley 10:59 on 05 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 19:40 on 04 Jan 2005

Re: [Templates] TT in callback
Arshavir Grigorian 22:16 on 07 Jan 2005

RE: [Templates] TT in callback
Jason Gottshall 22:29 on 05 Jan 2005

Re: [Templates] TT in callback
Mark Mills 22:46 on 05 Jan 2005

RE: [Templates] TT in callback
Simon Matthews 15:58 on 06 Jan 2005

RE: [Templates] TT in callback
Larry Leszczynski 19:44 on 06 Jan 2005

RE: [Templates] TT in callback
Simon Matthews 16:53 on 07 Jan 2005

RE: [Templates] TT in callback
Perrin Harkins 17:05 on 07 Jan 2005

Re: [Templates] TT in callback
Buddy Burden 23:52 on 07 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 05:18 on 05 Jan 2005

Re: [Templates] TT in callback
Cees Hek 05:48 on 05 Jan 2005

TT Caching (Was: Re: [Templates] TT in callback)
Larry Leszczynski 17:18 on 05 Jan 2005

Re: TT Caching (Was: Re: [Templates] TT in callback)
Perrin Harkins 18:07 on 05 Jan 2005

Re: TT Caching (Was: Re: [Templates] TT in callback)
Perrin Harkins 18:28 on 05 Jan 2005

Re: TT Caching (Was: Re: [Templates] TT in callback)
Larry Leszczynski 18:18 on 05 Jan 2005

Re: TT Caching (Was: Re: [Templates] TT in callback)
Perrin Harkins 19:15 on 05 Jan 2005

Re: TT Caching (Was: Re: [Templates] TT in callback)
Octavian Rasnita 19:00 on 05 Jan 2005

Re: TT Caching (Was: Re: [Templates] TT in callback)
merlyn (Randal L. Schwartz) 19:14 on 05 Jan 2005

Re: TT Caching (Was: Re: [Templates] TT in callback)
Octavian Rasnita 07:29 on 06 Jan 2005

Re: [Templates] TT in callback
Tony Bowden 15:05 on 06 Jan 2005

Re: [Templates] TT in callback
Andy Wardley 15:50 on 06 Jan 2005

Re: [Templates] TT in callback
Tony Bowden 09:09 on 07 Jan 2005

Re: TT Caching (Was: Re: [Templates] TT in callback)
Perrin Harkins 19:14 on 06 Jan 2005

Re: TT Caching (Was: Re: [Templates] TT in callback)
Octavian Rasnita 20:32 on 06 Jan 2005

Re: TT Caching (Was: Re: [Templates] TT in callback)
Perrin Harkins 21:14 on 06 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 19:44 on 08 Jan 2005

Re: [Templates] TT in callback
Bill Moseley 20:09 on 08 Jan 2005

Re: [Templates] TT in callback
Perrin Harkins 04:42 on 10 Jan 2005

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52