Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102644

Re: Heap Implementation

From Cem Karan <cfkaran2@gmail.com>
Newsgroups comp.lang.python
Subject Re: Heap Implementation
Date 2016-02-07 20:37 -0500
Message-ID <mailman.84.1454895431.2317.python-list@python.org> (permalink)
References <56AD3D83.2050308@mail.de>

Show all headers | View raw


On Jan 30, 2016, at 5:47 PM, Sven R. Kunze <srkunze@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 
> 
> @Cem
> 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.

<<SNIP>>

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.

Thanks,
Cem Karan

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Heap Implementation Cem Karan <cfkaran2@gmail.com> - 2016-02-07 20:37 -0500

csiph-web