pgsql: Fixup some misusages of bms_num_members()

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fixup some misusages of bms_num_members()
Date: 2020-08-25 22:52:16
Message-ID: E1kAhnc-0006WR-0F@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fixup some misusages of bms_num_members()

It's a bit inefficient to test if a Bitmapset is empty by counting all the
members and seeing if that number is zero. It's much better just to use
bms_is_empty(). Likewise for checking if there are at least two members,
just use bms_membership(), which does not need to do anything more after
finding two members.

Discussion: https://postgr.es/m/CAApHDvpvwm_QjbDOb5xga%2BKmX9XkN9xQavNGm3SvDbVnCYOerQ%40mail.gmail.com
Reviewed-by: Tomas Vondra

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c34605daed563fcade07a9f45bcf440459599c00

Modified Files
--------------
src/backend/optimizer/path/clausesel.c | 3 +--
src/backend/statistics/dependencies.c | 8 ++++----
2 files changed, 5 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2020-08-26 01:53:15 pgsql: Move codes for pg_backend_memory_contexts from mmgr/mcxt.c to ad
Previous Message Bruce Momjian 2020-08-25 13:53:29 pgsql: docs: client certificates are always sent to the server