public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chao Li <[email protected]>
To: Maksim.Melnikov <[email protected]>
Cc: [email protected]
Subject: Re: Preferred use of macro GetPGProcByNumber
Date: Mon, 15 Sep 2025 10:06:33 +0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>



> On Sep 12, 2025, at 20:39, Maksim.Melnikov <[email protected]> wrote:
> 
> Hello hackers,
> I've noticed some places where elements of ProcGlobal->allProcs are addressed directly via arr index.
> But in proc.h macros GetPGProcByNumber exist, that was added to get proc objects by index,
> so I suggest minor refactoring 'ProcGlobal->allProcs[index]' -> 'GetPGProcByNumber(index)'.
> Please, see attached patch, branched from rev 6ede13d1b5f.
> 
> Best regards
> Melnikov Maksim
> <v1-0001-Preferred-use-of-macro-GetPGProcByNumber.patch>


For the replacements in procarray.c, there may have slight performance difference. The current version stores dereferenced “allProcs” in a local static variable, which is faster than using the macro because the macro need to dereference “allProcs” from the “ProcGlobal” every time when it is called.

In other files, they are just simple direct replacements, so they should be fine.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Preferred use of macro GetPGProcByNumber
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox