Re: Making empty Bitmapsets always be NULL

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Yuya Watari <watari.yuya@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@lists.postgresql.org
Date: 2023-07-02T21:27:25Z
Lists: pgsql-hackers

Attachments

On Fri, 30 Jun 2023 at 14:11, Yuya Watari <watari.yuya@gmail.com> wrote:
> I have tested these versions with installcheck. Since the planning
> times obtained by installcheck vary each time, it is important to run
> it repeatedly and examine its distribution. I ran installcheck 100
> times for each version. The following tables and the attached figure
> show the results. From these results, we can conclude that the v4
> patch has no regression in the installcheck test. It seems to be
> slightly (0.31-0.38%) faster than the master. The difference between
> v4 and v4 with 0th word check is not so clear, but v4 may be faster.

I did the same on the AMD 3990x machine and an Apple M2 Pro machine.
On the M2 over the 100 runs v4 came out 1.18% faster and the 3990x was
1.25% faster than master. I've plotted the results in the attached
graphs.

Looking over the patch again, the only thing I'm tempted into changing
is to add Asserts like: Assert(a ==  NULL || a->words[a->nword - 1] !=
0) to each function just as extra reassurance that nothing
accidentally leaves trailing empty words.

If nobody else wants to take a look, then I plan to push the v4 + the
asserts in the next day or so.

David

Commits

  1. Remove trailing zero words from Bitmapsets

  2. Remove local optimizations of empty Bitmapsets into null pointers.

  3. Require empty Bitmapsets to be represented as NULL.

  4. Mop up some undue familiarity with the innards of Bitmapsets.

  5. Remove bms_first_member().