[Twisted-Python] Re: Performance issue in reactor.callLater

Michael Hudson mwh at python.net
Tue Sep 7 13:25:08 EDT 2004

Jp Calderone <exarkun at divmod.com> writes:

> Stefan Behnel wrote:
>> Stefan Behnel schrieb:
>>> I guess I do see a problem if the value of a call somewhere in the
>>> heap is changed. That brakes the heap invariant and may conflict
>>> with further changes to the heap. Let me think about it.
>> Ok, I thought about it. And I believe the best way to do this is to
>> write a specialized heap version. I copied the heapq implementation
>> and adapted it so that it keeps track of the position in the heap
>> for each DelayedCall. That makes it possible to remove a call
>> without linear overhead and in log(N) time.
>  > [snip]
>    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 also one of the newer, and hence less complicated in this
respect, bits of Python.  You can probably just get permission from
whoever wrote it...

# Original code by Kevin O'Connor, augmented by Tim Peters and Raymond Hettinger

it seems.


  "Also, does the simple algorithm you used in Cyclops have a name?"
  "Not officially, but it answers to "hey, dumb-ass!"
                       -- Neil Schemenauer and Tim Peters, 23 Feb 2001

More information about the Twisted-Python mailing list