From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
---|---|
To: | "Maksim(dot)Melnikov" <m(dot)melnikov(at)postgrespro(dot)ru> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Preferred use of macro GetPGProcByNumber |
Date: | 2025-09-15 02:06:33 |
Message-ID: | E2B04F4F-D792-4292-A978-38749662E246@gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On Sep 12, 2025, at 20:39, Maksim.Melnikov <m(dot)melnikov(at)postgrespro(dot)ru> 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/
From | Date | Subject | |
---|---|---|---|
Next Message | Dilip Kumar | 2025-09-15 02:46:01 | Re: Incorrect logic in XLogNeedsFlush() |
Previous Message | Chao Li | 2025-09-15 01:49:22 | Re: Fix missing EvalPlanQual recheck for TID scans |