[Twisted-Python] Performance issue in reactor.callLater

Bob Ippolito bob at redivi.com
Mon Sep 6 13:19:17 EDT 2004

On Sep 6, 2004, at 9:58 AM, Itamar Shtull-Trauring wrote:

> On Mon, 2004-09-06 at 09:43, Stefan Behnel wrote:
>> Are there any objections to replacing the current implementation?
> Not if yours is faster :) I would like to see some benchmarks comparing
> speed of adding and cancelling for cases with many scheduled calls, but
> also for cases with few calls, so we can see if your patches slow down
> other cases.

There's also the fact that this:

def infiniteLoop():
	reactor.callLater(0.0, infiniteLoop)

will just destroy Twisted because the current loop iteration will never 

In my non-Twisted implementation of the same concept, during each 
iteration I keep a list of new timers, which gets merged into the heap 
at the end of each iteration (so that they will be in the heap for the 
next round).

I'm not sure I understand the logic behind _cleanUpCallLater in the 
patch?  It doesn't seem right, especially for delayed, but I didn't 
really read very carefully.


More information about the Twisted-Python mailing list