Re: Remove post-increment in function quote_identifier of pg_upgrade

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Vaibhav Dalvi <vaibhav(dot)dalvi(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Remove post-increment in function quote_identifier of pg_upgrade
Date: 2021-04-29 14:51:05
Message-ID: 2988103.1619707865@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Justin Pryzby <pryzby(at)telsasoft(dot)com> writes:
> On Thu, Apr 29, 2021 at 06:35:28PM +0530, Vaibhav Dalvi wrote:
>> If my understanding is correct then '++' is not needed in the
>> above highlighted statement which is leading to overhead.

> I don't think the integer increment during pg_upgrade is a meaningful overhead.
> You could check the compiler's assembly output it may be the same even without
> the ++.

Yeah: if the increment actually costs something, I'd expect the compiler
to optimize it away. But on a lot of machine architectures, a pointer
post-increment is basically free anyhow.

> I'd suggest to leave it as it's currently written, since the idiom on every
> other line is *r++ = ..., it'd be strange to write it differently here, and
> could end up being confusing or copied+pasted somewhere else.

I agree --- cosmetically, this change isn't an improvement.

(On the other hand, if it were written the other way already, I'd also
argue to leave it like that. Basically, this sort of change is just not
worth troubling over. It doesn't improve things meaningfully and it
creates back-patching hazards.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2021-04-29 14:56:42 Re: Addition of authenticated ID to pg_stat_activity
Previous Message silvio brandani 2021-04-29 14:37:24 Re: tool to migrate database