cfkaran2 at gmail.com
Sun Feb 7 20:37:00 EST 2016
On Jan 30, 2016, at 5:47 PM, Sven R. Kunze <srkunze at mail.de> wrote:
> Hi again,
> as the topic of the old thread actually was fully discussed, I dare to open a new one.
> I finally managed to finish my heap implementation. You can find it at https://pypi.python.org/pypi/xheap + https://github.com/srkunze/xheap.
> I described my motivations and design decisions at http://srkunze.blogspot.com/2016/01/fast-object-oriented-heap-implementation.html
> You've been worried about a C implementation. I can assure you that I did not intend to rewrite the incredibly fast and well-tested heapq implementation. I just re-used it.
> I would really be grateful for your feedback as you have first-hand experience with heaps.
My apologies for not writing sooner, but work has been quite busy lately (and likely will be for some time to come).
I read your approach, and it looks pretty good, but there may be one issue with it; how do you handle the same item being pushed into the heap more than once? In my simple simulator, I'll push the same object into my event queue multiple times in a row. The priority is the moment in the future when the object will be called. As a result, items don't have unique priorities. I know that there are methods of handling this from the client-side (tuples with unique counters come to mind), but if your library can handle it directly, then that could be useful to others as well.
More information about the Python-list