On Fri, 15 Dec 2006 09:34:07 -0600, Manlio Perillo <manlio_perillo@libero.it> wrote:
L. Daniel Burr ha scritto:
[...] Re-writing rend,Page and flat to improve execution speed would most certainly be considered optimization.
Ok, lets consider it an optimization.
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.
My first question was: "Is it possible to use that same model used by django.template?"
Sure, but you posed that question for a reason. You didn't ask it because you thought it would be fun, you asked it because you found django to be faster, and wanted to use the same technique as django in order to make nevow faster.
I have posted my test results only later.
See above. You wouldn't have asked the question if you didn't want an optimization to be performed.
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.
The first test I have done was to compare the two web servers (Nevow + Twisted Web and Django + Lighttpd), obtaining the random data from a database.
Again, Nevow was much slower than Django.
Ok, that's great. Can you please provide the numbers? What was the concurrency level used?
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.
I ask again: Nevow uses a lot of object adaptation. Is this really necessary?
Please google for posts to this list regarding adaptation and various rendering-speed concerns by one Andrea Arcangeli. In his case, he found Cheetah to be much faster than Nevow, just as you found Django to be much faster than Nevow. The long and short of it is that yes, object adaptation is more expensive that not using any adaptation at all. The real question is, do you care enough to become familiar with the branch in which the context-removal changes are being made, and to help in moving that work forward?
Regards Manlio Perillo
Hope this helps, L. Daniel Burr