[Twisted-web] reduce deferred stack in nevow

Andrea Arcangeli andrea at cpushare.com
Wed Jan 19 20:09:17 MST 2005


On Thu, Jan 20, 2005 at 01:11:44PM +1100, Christopher Armstrong wrote:
> Did you actually find a real performance problem with using
> addCallback/addErrback? Do you know that there is a big difference in

Of course not (all cpu time seems spent for the rendering of the html),
but the current code looked less optimal than it could have been with a
simple change.

> semantics between addCallback/addErrback vs addCallbacks?

More or less. The first callback may actually return a Failure that will
cause the underlying errback to be called. Or the first errback may not
return an instance of the Failure class causing the next callback to be
called.

But I admit I didn't think about it while making the patch. So there's a
good chance it wasn't just incidental that the previous code was using
.addcallback/adderrback sorry. I was using the patch successfully but I
might have break something without noticing, sorry. You can ignore it
and if something we can concentrate on something more useful.

Since you mentioned a performance problem, the real performance problem
I have is in the rendering, that takes >150msec for my simplest page in
the whole site. The slowest takes 800msec and I'm going to make some
that will be even slower than that. You can easily reproduce with [0] *
300 passed as input to annotate.Choice(). Now for most of the http part
a reverse proxy can probably do the trick, but for the ssl part it can't
(even ignoring the ssl issues) because it's too dynamic.

Now it's not a short term problem, but I might have to solve that
eventually. Even if formless takes 2 seconds per page (not so
unrelistic) it's ok for the short term.

I wonder what can be done to boost the rendering (I was looking around
the code, and I thought the addcallback/adderrback would be a cleanup
but it wasn't sorry).

Thanks!



More information about the Twisted-web mailing list