Re: Remove post-increment in function quote_identifier of pg_upgrade - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Remove post-increment in function quote_identifier of pg_upgrade
Date
Msg-id 2988103.1619707865@sss.pgh.pa.us
Whole thread Raw
In response to Re: Remove post-increment in function quote_identifier of pg_upgrade  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-hackers
Justin Pryzby <pryzby@telsasoft.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



pgsql-hackers by date:

Previous
From: silvio brandani
Date:
Subject: Re: tool to migrate database
Next
From: Magnus Hagander
Date:
Subject: Re: Addition of authenticated ID to pg_stat_activity