Re: A tidyup of pathkeys.c - Mailing list pgsql-hackers

From Chao Li
Subject Re: A tidyup of pathkeys.c
Date
Msg-id 32B21F24-9EF5-4670-A24F-5CF0BC923A52@gmail.com
Whole thread Raw
In response to Re: A tidyup of pathkeys.c  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers


On Oct 14, 2025, at 19:22, David Rowley <dgrowleyml@gmail.com> wrote:

What makes you think making them inline would make the performance the
same as before? The previous functions were not inlined, and I've not
made any changes that should affect the compiler's ability to choose
to inline these functions or not.

Ah… You are right. The old code:

static int
pathkeys_useful_for_ordering(PlannerInfo *root, List *pathkeys)
{
int n_common_pathkeys;

(void) pathkeys_count_contained_in(root->sort_pathkeys, pathkeys,
&n_common_pathkeys);

return n_common_pathkeys;
}

Your patch’s code:

static int
count_common_leading_pathkeys_ordered(List *keys1, List *keys2)
{
int ncommon;

(void) pathkeys_count_contained_in(keys1, keys2, &ncommon);

return ncommon;
}

They both call pathkeys_count_contained_in(), you are NOT adding an extra wrapper. So, I withdraw the “inline” comment.

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




pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: pg_createsubscriber - more logging to say if there are no pubs to drop
Next
From: Michael Paquier
Date:
Subject: Re: get rid of RM_HEAP2_ID