Re: Microoptimization of Bitmapset usage in postgres_fdw

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Microoptimization of Bitmapset usage in postgres_fdw
Date: 2018-06-17 12:47:36
Message-ID: 20180617124736.GA4348@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 14, 2018 at 08:14:54PM +0000, Bossart, Nathan wrote:
> I'll go ahead and mark this as Ready for Committer.

Another thing not mentioned on this thread is that bms_membership is
faster than bms_num_members by design with many members, so this change
makes sense to shave a couple of cycles.

/*
* bms_num_members - count members of set
+ *
+ * In situations where the exact count isn't required, bms_membership can be
+ * used to test if the set has 0, 1 or multiple members.
*/
bms_membership is a couple of lines down, I am not sure I see much point
in duplicating what's already present.

- if (bms_num_members(clauses_attnums) < 2)
+ if (bms_membership(clauses_attnums) != BMS_MULTIPLE)
For this one, the comment above directly mentions that at least two
attnums need to be present, so it seems to me that the current coding is
easier to understand and intentional... So I would be incline to not
change it.

I think that this should not go into the tree until REL_11_STABLE gets
created though, so this will have to wait a bit.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2018-06-17 12:47:50 Re: pg_config.h.win32 missing a set of flags from pg_config.h.in added in v11 development
Previous Message Michael Paquier 2018-06-17 12:15:20 Re: pg_config.h.win32 missing a set of flags from pg_config.h.in added in v11 development