Re: [PATCH] binary heap implementation

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Andres Freund <andres@2ndquadrant.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, Tom Lane <tgl@sss.pgh.pa.us>, Abhijit Menon-Sen <ams@2ndquadrant.com>, pgsql-hackers@postgresql.org
Date: 2012-11-27T16:56:41Z
Lists: pgsql-hackers

Attachments

[ Sorry for the slow response on this, Thanksgiving interfered. ]

On Wed, Nov 21, 2012 at 3:41 PM, Andres Freund <andres@2ndquadrant.com> wrote:
> One very minor nitpick I unfortunately just found now, not sure when
> that changed:
> binaryheap_replace_first() hardcodes the indices for the left/right node
> of the root node. I would rather have it use (left|right)_offset(0).

Hmm, yeah... but come to think of it, why do we need that special case
at all?  Why not just call sift_down on the root node and call it
good?  See the attached version, which simplifies the code
considerably and also makes some comment adjustments per Abhijit's
comments.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix memory leaks in record_out() and record_send().