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


Groups > comp.lang.python > #102644 > unrolled thread

Re: Heap Implementation

Started byCem Karan <cfkaran2@gmail.com>
First post2016-02-07 20:37 -0500
Last post2016-02-07 20:37 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#102644 — Re: Heap Implementation

FromCem Karan <cfkaran2@gmail.com>
Date2016-02-07 20:37 -0500
SubjectRe: Heap Implementation
Message-ID<mailman.84.1454895431.2317.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web