[Twisted-Python] Performance issue in reactor.callLater

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Wed Sep 8 10:37:04 EDT 2004


Glyph Lefkowitz schrieb:
 > runUntilCurrent happens every tick; callLater only happens sometimes.

Calling the method "runUntilCurrent", yes. But that's not important. What makes a difference is that each iteration of the loop in runUntilCurrent is called at most once per callLater, so there is never fewer calls to callLater than iterations in runUntilCurrent - but in many cases there will be more calls to callLater, which gets even worse if you also count calls to cancel and reset. "runUntilCurrent" really is the right place to make the trade-off.


 > Rather than say "average" applications: In my understanding, this will
 > speed up applications that have lots of timed events scheduled at the
 > expense of applications that transfer data over the network.

Just to make myself a bit clearer: runUntilCurrent only gets slower /per delayed call/. So if there are no delayed calls there should be no (measurable) slow down. But if there are delayed calls you will get the speed up.

Stefan





More information about the Twisted-Python mailing list