Re: NUMERIC private methods? - Mailing list pgsql-hackers

From David Fetter
Subject Re: NUMERIC private methods?
Date
Msg-id 20141216133145.GB10843@fetter.org
Whole thread Raw
In response to Re: NUMERIC private methods?  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-hackers
On Tue, Dec 16, 2014 at 09:01:47AM +0000, Andrew Gierth wrote:
> >>>>> "Heikki" == Heikki Linnakangas <hlinnakangas@vmware.com> writes:
> 
>  Heikki> Looking at the weighed_stats code, this probably illustrates
>  Heikki> the hoops you had to jump through:
> 
> Actually that hoop-jumping expression is almost irrelevant.

Right.  Not that it made things fun or easy (at least for me) to
debug, as you can see by the git history.

> The part that hurts (and yes, it's performance that's at issue here,
> and not code aesthetics) is not being able to use NumericVar in the
> aggregate's transition variable, because that means that every
> computed intermediate value is palloc'd and pfree'd twice (once as
> the digit buffer of a NumericVar and again as a Numeric datum).

Yep.  Performance of NUMERIC might yet get some of the love it
deserves.  Perhaps something along the lines of a 128-bit default
structure with a promotion/demotion scheme for larger representations.
Until then, those of us writing extensions are stuck with heaps of
extra instructions in it that could easily be trimmed away to good
effect.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



pgsql-hackers by date:

Previous
From: Mark Cave-Ayland
Date:
Subject: Re: Commitfest problems
Next
From: Heikki Linnakangas
Date:
Subject: Re: KNN-GiST with recheck