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


Groups > comp.lang.python > #102333

Re: Heap Implementation

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From srinivas devaki <mr.eightnoteight@gmail.com>
Newsgroups comp.lang.python
Subject Re: Heap Implementation
Date Sun, 31 Jan 2016 10:29:38 +0530
Lines 45
Message-ID <mailman.151.1454216427.2338.python-list@python.org> (permalink)
References <56AD3D83.2050308@mail.de>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de mtP25lTFCr6Pr4qTzc2ifg3H9GRG+IT63/zxeE3+FRDQ==
Return-Path <mr.eightnoteight@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'url:pypi': 0.03; 'received:209.85.223': 0.03; 'rewrite': 0.07; 'cc:addr:python- list': 0.09; 'url:github': 0.09; 'thread': 0.10; 'python': 0.10; 'jan': 0.11; 'weird': 0.15; '2016': 0.16; 'brilliant': 0.16; 'formatting.': 0.16; 'heap': 0.16; 'heapq': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'all,': 0.20; 'cc:addr:python.org': 0.20; 'cc:2**1': 0.22; 'meant': 0.22; '31,': 0.22; 'fixing': 0.22; 'am,': 0.23; 'elements': 0.23; 'references': 0.23; 'cc:addr:gmail.com': 0.24; 'header:In-Reply-To:1': 0.24; 'compare': 0.27; 'switch': 0.27; 'message-id:@mail.gmail.com': 0.27; 'post': 0.31; 'topic': 0.32; 'url:python': 0.33; 'grateful': 0.33; 'items.': 0.33; 'open': 0.33; 'received:google.com': 0.35; 'best,': 0.35; 'instead': 0.36; 'url:org': 0.36; 'tool': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'missing': 0.37; 'received:209': 0.38; 'feedback': 0.38; 'some': 0.40; 'your': 0.60; 'skip:u 10': 0.61; 'periodically': 0.66; 'finally': 0.70; 'incredibly': 0.76; 'removal': 0.79; 'combo': 0.84; 'sweeping': 0.84; 'url:2016': 0.84; 'worried': 0.84; 'dare': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=7T9I6CPRJ2sX1nlMdvFGvQDMdX56NZYJecc7qJJckhk=; b=ruvjl9FbXKk8X9jzjemWLnoGZQf6vgjcv/gZdstjBZe3rCvP1qqxQ7l0nuQ0tufPCN 8Z/h/AuAS3adigfOhH0dyF+kyfeEe+tI7JjJKxXg/y0qDcZTvtVkvUzbzjRiyTHsiUH3 2inLhf3v5t8sA8KNPGxqN/mkh3gk7x11hqJihhPnGL0oocrlhO5zqEq64DXxSAPidDDD /R6pZLGCVTo3l19PzEuvjuHKfYI98IwM7OXOSkVBvI4ZGzNop3tZQGsNYhQLlLCacrRa +SD62veAk/V//MEkEJEVWlHh946nIig8hb5MLCnr2N0Pbm59+KJ9Mx+tInAPVk//34BI gQsA==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=7T9I6CPRJ2sX1nlMdvFGvQDMdX56NZYJecc7qJJckhk=; b=N11trL2Rlyg0SPH+9qLDf/rzeYXyymPDoPTNqx8/pDsAnTwnvEjopuDWi+bTTynIhp pacTDxcEcst5utGjdNf2cBhAyiPUz+mpwWAn8Nrp7veIflmzUtbEuH1fSSdt8PPrtBuL QLTFaIqycgqk6lX3YeYFYFUsN0bDwmcY0v4WD+unQ3E6+pmGkK+s1THSyGWTG/PQMx2W Ryn0t97peMfLhtJ/1E/BUFJPHszyGaO0ico6F27Fiz0McTkYLQeFpLcOMHGsnF6uAVcn Ei6Bx9wA7TMpgxJ2yh6dahvbOxN19KhENuhvxl/LmNcDBJEmLfZIgb1b+uRqljCSRvnp ixcQ==
X-Gm-Message-State AG10YOTmC6y3aeE8HZAgaQZo/6pM/lJVia1BYgYEOXsZdhIH5lbuO55isUMfS8JmE4v8FF4FkSNjKFRf6Sgq+w==
X-Received by 10.107.135.30 with SMTP id j30mr17558756iod.103.1454216418061; Sat, 30 Jan 2016 21:00:18 -0800 (PST)
In-Reply-To <56AD3D83.2050308@mail.de>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:102333

Show key headers only | View raw


@Sven
actually you are not sweeping at all, as i remember from my last post
what i meant by sweeping is periodically deleting the elements which
were marked as popped items.

kudos on that __setitem__ technique,
instead of using references to the items like in HeapDict, it is
brilliant of you to simply use __setitem__

On Sun, Jan 31, 2016 at 4:17 AM, 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.
>
> @srinivas
> You might want to have a look at the removal implementation. Do you think it
> would be wiser/faster to switch for the sweeping approach?
>
> I plan to publish some benchmarks to compare heapq and xheap.
>
> @all
> What's the best/standardized tool in Python to perform benchmarking? Right
> now, I use a self-made combo of unittest.TestCase and time.time + proper
> formatting.
>
> Best,
> Sven
>
>
> PS: fixing some weird typos and added missing part.

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


Thread

Re: Heap Implementation srinivas devaki <mr.eightnoteight@gmail.com> - 2016-01-31 10:29 +0530

csiph-web