[Twisted-web] [Nevow] template performance

Jean-Paul Calderone exarkun at divmod.com
Fri Dec 15 07:03:28 CST 2006


On Fri, 15 Dec 2006 11:56:55 +0100, Manlio Perillo <manlio_perillo at libero.it> wrote:
>First let me say that I really like Nevow template system.
>Once you became expert with it, it proves to be really flexible.
>
>The problem is the performance.
>I have done a simple test with the rendering of a table 5 * 20, Nevow 
>against Django, and Nevow is much slower.
>
>The problem is that, I think, there are a lot of objects adaptation.
>
>Is it possible to use that same model used by django.template?
>
>You pass a context (that is a dictionary usable like a stack: push/pop) to 
>the render function.
>All the data directive will search the data in the context (like djando, 
>first dictionary lookup, then attribute lookup, and so).
>
>As an example n:data='x.y' ==> ctx['x']['y'].
>A rend.Page.renderHTTP can build a context from the instance dictionary.
>

Optimization can be a complicated undertaking.  I urge you to take a look
at the cProfile module included with Python 2.5 or the "lsprof" distribution
of the same module for Python 2.4.  When you have evidence of a particular
bottleneck, please post again.  If you have already collected profiling data,
please include it whenever you post about performance.

Jean-Paul



More information about the Twisted-web mailing list