how to convert code that uses cmp to python3
Paul Rubin
no.email at nospam.invalid
Fri Apr 8 03:03:53 EDT 2016
Marko Rauhamaa <marko at pacujo.net> writes:
> On the surface, the garbage collection scheme looks dubious, but maybe
> it works perfect in practice.
It looked suspicious at first glance but I think it is ok. Basically on
at most every timeout event (scheduling, expiration, or cancellation),
it does an O(n) operation (scanning and re-heapifying the timeout list)
with probability O(1/n) where n is the queue size, which itself changes
(by 0, +1 or -1) when a timeout event happens. That is, its overhead is
a constant factor unless I'm missing something. There are some
efficiency gains possible but it seems par for the course for Python
code.
More information about the Python-list
mailing list