Re: Templates, filesystem, caching?

2007-12-24 Thread Malcolm Tredinnick
On Sat, 2007-12-22 at 23:00 -0800, Rob Hudson wrote: [...] > I wonder if the template system has become a bit more complex since > then. I also wonder if whatever tests they used included things like > includes in for loops. I tend to think that the filesystem is slow > and anything to remove

Re: Templates, filesystem, caching?

2007-12-23 Thread forgems
Template loader returns a source code for template, not parsed Template object. So no big gain here :( > In the early days of Django, Adrian, Simon et al looked at that. It > wasn't worth it, since, in the grand scheme of things, template caching > and checking the cache wasn't that much faster

Re: Templates, filesystem, caching?

2007-12-23 Thread forgems
Hi. In production environment IMHO it really doesn't matter because you have to restart server anytime you change the python code. If you treat templates as code that really doesn't matter. We have about 50 production servers and we restart a farm every time we change the code. We do it

Re: Templates, filesystem, caching?

2007-12-23 Thread Rob Hudson
On 12/23/07, Eratothene <[EMAIL PROTECTED]> wrote: > Your snippet requires to restart django each time the templates have > changed. Did you try to add checking of template file modification > date in order automatically invalidate cache? What it is performance > of such implementation? Adding

Re: Templates, filesystem, caching?

2007-12-23 Thread Eratothene
Hi forgems! Your snippet requires to restart django each time the templates have changed. Did you try to add checking of template file modification date in order automatically invalidate cache? What it is performance of such implementation? Adding this kind of mechanism will increase performace

Re: Templates, filesystem, caching?

2007-12-23 Thread forgems
Hi, i'm author of the snippet http://www.djangosnippets.org/snippets/507/. I have used simple dictionary because pickling and unpickling values from the cache are IMHO to expensive and don't give a big speed boost over parsing. Also if you use memcache or filesystem backend for caching (pretty

Re: Templates, filesystem, caching?

2007-12-22 Thread Rob Hudson
On 12/21/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > In the early days of Django, Adrian, Simon et al looked at that. It > wasn't worth it, since, in the grand scheme of things, template caching > and checking the cache wasn't that much faster than loading and parsing, > particularly in

Re: Templates, filesystem, caching?

2007-12-21 Thread Malcolm Tredinnick
On Tue, 2007-12-18 at 15:47 +0100, Michael Elsdörfer wrote: > James Bennett schrieb: > > Manually call get_template() or select_template(), and stuff the > > resulting Template object into a module-global variable somewhere. > > Then just re-use it, calling render() with different contexts, each

Re: Templates, filesystem, caching?

2007-12-21 Thread Empty
On Dec 21, 2007 4:50 PM, SmileyChris <[EMAIL PROTECTED]> wrote: > > After reading this thread the other day, I decided to write up a patch > [1]. > > [1] http://code.djangoproject.com/ticket/6262 Of course you did. Always with the patches. :) P.S. Thank you Michael Trier blog.michaeltrier.com

Re: Templates, filesystem, caching?

2007-12-18 Thread Rob Hudson
On 12/18/07, Michael Elsdörfer <[EMAIL PROTECTED]> wrote: > James Bennett schrieb: > > Manually call get_template() or select_template(), and stuff the > > resulting Template object into a module-global variable somewhere. > > Then just re-use it, calling render() with different contexts, each >

Re: Templates, filesystem, caching?

2007-12-18 Thread Michael Elsdörfer
James Bennett schrieb: > Manually call get_template() or select_template(), and stuff the > resulting Template object into a module-global variable somewhere. > Then just re-use it, calling render() with different contexts, each > time you need it. Is there anything speaking against building

Re: Templates, filesystem, caching?

2007-12-17 Thread Udi
Manually call get_template() or select_template(), and stuff the >resulting Template object into a module-global variable somewhere. >Then just re-use it, calling render() with different contexts, each >time you need it. Along those lines, I recently noticed this bit of code that swaps the

Re: Templates, filesystem, caching?

2007-12-17 Thread James Bennett
On Dec 17, 2007 4:03 PM, Rob Hudson <[EMAIL PROTECTED]> wrote: > If I understand correctly, these cache the templates after they have > been rendered. What I'm curious about is if there is a way to cache > templates before they are rendered so you can provide different > contexts to them. It

Re: Templates, filesystem, caching?

2007-12-17 Thread Michael Elsdörfer
Rob Hudson schrieb: > If I understand correctly, these cache the templates after they have > been rendered. What I'm curious about is if there is a way to cache > templates before they are rendered so you can provide different > contexts to them. It seems like there would still be some gains

Re: Templates, filesystem, caching?

2007-12-17 Thread Rob Hudson
On 12/17/07, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > http://www.djangoproject.com/documentation/cache/ If I understand correctly, these cache the templates after they have been rendered. What I'm curious about is if there is a way to cache templates before they are rendered so you can

Re: Templates, filesystem, caching?

2007-12-17 Thread Alex Koshelev
http://www.djangoproject.com/documentation/cache/ On 17 дек, 23:49, "Rob Hudson" <[EMAIL PROTECTED]> wrote: > Howdy, > > A thought occurred to me today and I'm not 100% sure what Django does > by default... > > Similar to the idea that PHP parses scripts for each request and > having an opcode

Templates, filesystem, caching?

2007-12-17 Thread Rob Hudson
Howdy, A thought occurred to me today and I'm not 100% sure what Django does by default... Similar to the idea that PHP parses scripts for each request and having an opcode cache can increase performance, I'm wondering if Django reads templates from the file system, parses them, and then does