[Twisted-web] Re: [Nevow] template performance
Michael Hudson
mwh at python.net
Fri Dec 15 06:21:05 CST 2006
Manlio Perillo <manlio_perillo at libero.it> writes:
> 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.
How confident are you about that? When I was last playing this game,
it seemed to be copying lots and lots of stuff that was the main
source of the slowdown, and I got a factor of 2 speedup by dint of a
hack:
http://codespeak.net/svn/user/mwh/pydoctor/trunk/pydoctor/nevowhtml/__init__.py
> 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.
I'm not sure I understand. You can implement IResource.renderHTTP
however you like, I guess...
Cheers,
mwh
--
Need to Know is usually an interesting UK digest of things that
happened last week or might happen next week. [...] This week,
nothing happened, and we don't care.
-- NTK Now, 2000-12-29, http://www.ntk.net/
More information about the Twisted-web
mailing list