pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Improve div_var_fast(), mostly by making comments better.
Date: Wed, 25 Nov 2015 21:06:02 +0000
Message-ID: <E1a1hGM-0006iw-JN@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Improve div_var_fast(), mostly by making comments better.

The integer overflow situation in div_var_fast() is a great deal more
complicated than the pre-existing comments would suggest.  Moreover, the
comments were also flat out incorrect as to the precise statement of the
maxdiv loop invariant.  Upon clarifying that, it becomes apparent that the
way in which we updated maxdiv after a carry propagation pass was overly
slow, complex, and conservative: we can just reset it to one, which is much
easier and also reduces the number of times carry propagation occurs.
Fix that and improve the relevant comments.

Since this is mostly a comment fix, with only a rather marginal performance
boost, no need for back-patch.

Tom Lane and Dean Rasheed

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/46166197c3b3748c3266c694d7c2f5a312ea928e

Modified Files
--------------
src/backend/utils/adt/numeric.c |   64 +++++++++++++++++++++++++++++++--------
1 file changed, 52 insertions(+), 12 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1a1hGM-0006iw-JN@gemulon.postgresql.org>
Permalink:  ../E1a1hGM-0006iw-JN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1a1hGM-0006iw-JN@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Improve div_var_fast(), mostly by making comments better.
  In-Reply-To: <E1a1hGM-0006iw-JN@gemulon.postgresql.org>
  References: <E1a1hGM-0006iw-JN@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox