[Twisted-Python] Performance issue in reactor.callLater

Bob Ippolito bob at redivi.com
Tue Sep 7 14:51:14 EDT 2004

On Sep 7, 2004, at 2:28 PM, Itamar Shtull-Trauring wrote:

> On Tue, 2004-09-07 at 14:13, Glyph Lefkowitz wrote:
>>>    heapq.py is under the PSF license.  PSF is roughly similar to MIT.
>>> Is this going to be okay for inclusion in Twisted?
>> It's part of Python, so I don't see why that would be necessary.
> This is patched / somehow different version.
>> However, I have profiled various heapq-based schemes for callLater in
>> the past, and they always end up losing pretty big in the average 
>> case,
>> and winning only in perverse cases such as hundreds of callLater(0)s 
>> per
>> tick.  I saw a little discussion of the performance impact, but I am
>> still not entirely convinced that it's a good idea.
> Obviously we wouldn't commit without further performance testing.

What is the "average" case anyway?  For what application?  Where are 
the performance tests coming from?

There is at least one scenario where it makes perfect sense to do a lot 
of callLater(0.0, ...), when you're doing computation but trying not to 

Though, of course, you would do something like callLater(0.00001, ...) 
in the current Twisted, because callLater(0.0, ...) pretty much blocks.


More information about the Twisted-Python mailing list