[Twisted-web] [Nevow] template performance

L. Daniel Burr ldanielburr at mac.com
Fri Dec 15 09:04:28 CST 2006

On Fri, 15 Dec 2006 08:43:44 -0600, Manlio Perillo  
<manlio_perillo at libero.it> wrote:

> Jean-Paul Calderone ha scritto:
>> On Fri, 15 Dec 2006 11:56:55 +0100, Manlio Perillo  
>> <manlio_perillo at libero.it> wrote:
>> [...]
>>> 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'm not asking for optimization.
> I'm asking for a possible rewriting of how rend.Page (and flat) works.

Re-writing rend,Page and flat to improve execution speed would most
certainly be considered optimization.  I'm not sure why you think
otherwise; could you please explain?

Note that I am confident that we'd all like Nevow to be faster, but
optimization requires a lot more than just a cursory analysis.  I
get the impression from reading your post that you think your
request is simple/trivial, and perhaps it seems that way, but there
is a lot more to this.

What you have done, so far, is to measure raw serialization speed,
and in so doing, you've found that Django is faster.  That part
is fine, but the conclusion you've drawn is questionable.  Do you
know if the difference in speed actually makes any difference in
a real web application?  I'll bet that other factors, such as
database access and network latency generally account for the
majority of time that it takes for a request to be serviced.

Please understand, I am not trying to offend you or tell you that
Nevow doesn't need improving; everyone agrees that it could be a
lot better.  I am just trying to point out that your observations
regarding serialization speed have not been made in a context that
demonstrates a serious need to rewrite rend.Page and flat.flatten.

Put another way, there are lots of automobiles in the world that
go faster than my automobile, but unless my automobile is so slow
that it overwhelms all other factors (traffic, for example), I
don't really need to fix it, and could better spend my time on
other things, like finding a better route to work.

Hope this helps,

L. Daniel Burr

More information about the Twisted-web mailing list