Re: NUMERIC private methods?

From: David Fetter <david(at)fetter(dot)org>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NUMERIC private methods?
Date: 2014-12-16 13:31:45
Message-ID: 20141216133145.GB10843@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 16, 2014 at 09:01:47AM +0000, Andrew Gierth wrote:
> >>>>> "Heikki" == Heikki Linnakangas <hlinnakangas(at)vmware(dot)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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-12-16 13:37:00 Re: KNN-GiST with recheck
Previous Message Mark Cave-Ayland 2014-12-16 11:22:45 Re: Commitfest problems