[Twisted-web] [Twisted-Python] Speed of rendering?

Glyph glyph at twistedmatrix.com
Wed Oct 24 04:16:09 EDT 2012


On Oct 23, 2012, at 8:10 AM, Peter Westlake <peter.westlake at pobox.com> wrote:

> 
> 
> On Tue, Sep 4, 2012, at 19:30, Glyph wrote:
> 
> ...
> 
>>>>> 
>>>>> Not only is there a profiler, there's benchmarks!
>>>>> 
>>>>> 	<http://speed.twistedmatrix.com/timeline/>
>>>>> 
>>>>> Maybe you could add one for twisted.web.template rendering speed?
>>> 
>>> Okay, I've found out how to use the profiler (though I never did
>>> find out what I did wrong the first time) and I'm reading the docs
>>> about how to interpret the results. The benchmark code doesn't look
>>> as though it uses the profiler, just times a number of repetitions
>>> - is that right? So a benchmark for t.w.template would consist of
>>> some functions that called flatten() once each?
>> 
>> 
>> That's the general idea, yes.  Of course, each benchmark should try to be
>> vaguely representative of some real-world use-case so that we don't
>> optimize one case too much in favor of another.
> 
> Glyph,
> 
> I haven't forgotten about this.

Thanks for sticking with it :).

> The problem I'm having is that flatten() returns immediately if given a string or anything else without an unfired Deferred, and that sends Client._continue into an unbounded recursion. Is there a general good way to handle this kind of problem? Somehow I need to return control to the reactor long enough for Client._request to return.

That sounds like a bug, although it's hard to say without seeing the exact code that you're talking about.  Can you send a representative example?

-g


More information about the Twisted-web mailing list