List Info

Thread: Performance and caching




Performance and caching
user name
2006-05-18 13:25:17
The Catalyst docs suggest that the following settings are
used to
improve performance (in a ::View::TT):-

__PACKAGE__->config(
    {
       ...
        #
        # performance tweaks
        COMPILE_DIR        =>
dir(MyApp->config->,
                                  'tmp'),
        STASH              =>
Template::Stash::XS->new,
    }
);


Now the Template::Stash::XS recommendation make sense, and
presumably
benefits all apps.  

However the TT documentation implies to me that setting
COMPILE_DIR is
only of use when a process is restarted - so a long lived
FastCGI or
mod_perl process would gain little benefit (and potentially
take a hit
if it stats the cached files).

In the docs for Template::Provider is the section:-
CACHE_SIZE
        The Template::Provider module caches compiled
templates to avoid
        the need to re-parse template files or blocks each
time they are
        used. The CACHE_SIZE option is used to limit the
number of
        compiled templates that the module should cache.
        
        By default, the CACHE_SIZE is undefined and all
compiled
        templates are cached. When set to any positive
value, the cache
        will be limited to storing no more than that number
of compiled
        templates. When a new template is loaded and
compiled and the
        cache is full (i.e. the number of entries ==
CACHE_SIZE), the
        least recently used compiled template is discarded
to make room
        for the new one.
        
        The CACHE_SIZE can be set to 0 to disable caching
altogether.
        

To me this implies that *by default* TT in a long lived
process will
cache all the compiled templates, and so caching them on
disk is only
useful for restarting a process.

Am I right in this or just deluded as usual?

	Nigel.
-- 
[ Nigel Metheringham           Nigel.MetheringhamInTechnology.co.uk ]
[ - Comments in this message are my own and not ITO
opinion/policy - ]


_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
Performance and caching
user name
2006-05-18 14:30:58
Nigel Metheringham wrote:
> However the TT documentation implies to me that setting
COMPILE_DIR is
> only of use when a process is restarted - so a long
lived FastCGI or
> mod_perl process would gain little benefit (and
potentially take a hit
> if it stats the cached files).

But these processes do die and new ones are created on a
fairly regular 
basis in most apps.  Skipping all of the template compiling
in a newly 
spawned process might make a big difference until it has
them all cached.

- Perrin

_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )