Re: Constifying numeric.c's local vars

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Constifying numeric.c's local vars
Date: 2017-09-11 12:10:14
Message-ID: 11630.1505131814@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> One large user of unnecessary non-constant static variables is
> numeric.c. More out of curiosity - numeric is slow enough in itself to
> make inlining not a huge win - I converted it to use consts.

LGTM.

> It's a bit ugly that some consts have to be casted away in the constant
> definitions, but aside from just inlining the values, I don't quite see
> a better solution?

No, I don't either. I'm not sure that writing the constant inline would
produce the desired results - the compiler might well decide that it had
to be in read-write storage.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2017-09-11 12:26:54 Re: Re: proposal - using names as primary names of plpgsql function parameters instead $ based names
Previous Message Ashutosh Bapat 2017-09-11 12:07:13 Re: Partition-wise join for join between (declaratively) partitioned tables