Re: [BackendXidGetPid] only access allProcs when xid matches - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: [BackendXidGetPid] only access allProcs when xid matches
Date
Msg-id CAExHW5v=aAXtKfKAaYx96t=VXFnkVuKShgCcD7n9-t7d=jT8=Q@mail.gmail.com
Whole thread Raw
In response to [BackendXidGetPid] only access allProcs when xid matches  (Junwang Zhao <zhjwpku@gmail.com>)
Responses Re: [BackendXidGetPid] only access allProcs when xid matches
List pgsql-hackers
On Wed, Aug 9, 2023 at 9:30 AM Junwang Zhao <zhjwpku@gmail.com> wrote:
>
> In function `BackendXidGetPid`, when looping every proc's
>     TransactionId, there is no need to access its PGPROC since there
>     is shared memory access: `arrayP->pgprocnos[index]`.
>
>     Though the compiler can optimize this kind of inefficiency, I
>     believe we should ship with better code.
>

Looks good to me. However, I would just move the variable declaration
with their assignments inside the if () rather than combing the
expressions. It more readable that way.

--
Best Wishes,
Ashutosh Bapat



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Support to define custom wait events for extensions
Next
From: Peter Eisentraut
Date:
Subject: Re: Fix last unitialized memory warning