Hey Huub,

When your app is up and running, there shouldn't be a difference.

If you're using the module-loader, then it'll look for a cached
version of the generated Python module. The memory loader always
compiles.

If you're experiencing a slowdown, then maybe it's because you're
instantiating `PageTemplateFile` manually (and often) without using a
loader:

  >>> from chameleon.zpt.loader import TemplateLoader
  >>> loader = TemplateLoader("/path/to/templates")

The difference is that the loader now has a memory loader which is
used every time you load a template with that loader.

\malthe

On 13 December 2012 12:39, Huub Bouma <bo...@w20e.com> wrote:
> Hi everyone,
>
> I noticed a poor performance when rendering my chameleon templates in
> non-debug mode. When I looked into the chameleon code I found why:
>
>     if DEBUG_MODE or CACHE_DIRECTORY:
>         loader = _make_module_loader()
>     else:
>         loader = MemoryLoader()
>
> The CACHE_DIRECTORY wasn't set (which you can set with the environment
> variable CHAMELEON_CACHE). So when I did, the performance was great.
>
> Now my questions are:
>
> Is the MemoryLoader indeed slower then the ModuleLoader?
>
> If the MemoryLoader is slower, then why is it used in production mode? Is
> this a bug?
>
> This would make more sense to me:
>
>     if DEBUG_MODE:
>         loader = MemoryLoader()
>     else:
>         loader = _make_module_loader()
>
> Cheers, Huub
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pylons-discuss/-/vBdD1VXceSYJ.
> To post to this group, send email to pylons-discuss@googlegroups.com.
> To unsubscribe from this group, send email to
> pylons-discuss+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.



-- 
Au revoir, et tous mes voeux pour un avenir plein de succès et de bonheur ––

Malthe Borch
mbo...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to