Re: Optmize bitmapword macros calc (src/backend/nodes/bitmapset.c)

2024-01-30 Thread Ranier Vilela
Em seg., 29 de jan. de 2024 às 19:40, Nathan Bossart < nathandboss...@gmail.com> escreveu: > On Tue, Jan 30, 2024 at 11:23:57AM +1300, David Rowley wrote: > > On Tue, 30 Jan 2024 at 08:32, Nathan Bossart > wrote: > >> I'm currently +0.1 for this change. I don't see any huge problem with > >>

Re: Optmize bitmapword macros calc (src/backend/nodes/bitmapset.c)

2024-01-29 Thread Nathan Bossart
On Tue, Jan 30, 2024 at 11:23:57AM +1300, David Rowley wrote: > On Tue, 30 Jan 2024 at 08:32, Nathan Bossart wrote: >> I'm currently +0.1 for this change. I don't see any huge problem with >> trimming a few instructions, but I'm dubious there's any measurable impact. >> However, a cycle saved is

Re: Optmize bitmapword macros calc (src/backend/nodes/bitmapset.c)

2024-01-29 Thread David Rowley
On Tue, 30 Jan 2024 at 08:32, Nathan Bossart wrote: > I'm currently +0.1 for this change. I don't see any huge problem with > trimming a few instructions, but I'm dubious there's any measurable impact. > However, a cycle saved is a cycle earned... FWIW, In [1] and subsequent replies, there are

Re: Optmize bitmapword macros calc (src/backend/nodes/bitmapset.c)

2024-01-29 Thread Nathan Bossart
On Mon, Jan 29, 2024 at 04:43:32PM -0300, Ranier Vilela wrote: > Em seg., 29 de jan. de 2024 às 16:32, Nathan Bossart < > nathandboss...@gmail.com> escreveu: >> -#define WORDNUM(x) ((x) / BITS_PER_BITMAPWORD) >> -#define BITNUM(x) ((x) % BITS_PER_BITMAPWORD) >> +#define WORDNUM(x)

Re: Optmize bitmapword macros calc (src/backend/nodes/bitmapset.c)

2024-01-29 Thread Ranier Vilela
Em seg., 29 de jan. de 2024 às 16:32, Nathan Bossart < nathandboss...@gmail.com> escreveu: > On Mon, Jan 29, 2024 at 01:30:47PM -0300, Ranier Vilela wrote: > > IMO I believe that bitmapset can obtain an optimization in the > calculation > > of the WORDNUM and BITNUM macros. > > > > As you know,

Re: Optmize bitmapword macros calc (src/backend/nodes/bitmapset.c)

2024-01-29 Thread Nathan Bossart
On Mon, Jan 29, 2024 at 01:30:47PM -0300, Ranier Vilela wrote: > IMO I believe that bitmapset can obtain an optimization in the calculation > of the WORDNUM and BITNUM macros. > > As you know, in bitmapset, negative members are not allowed. > > if (x < 0) > elog(ERROR, "negative bitmapset member

Optmize bitmapword macros calc (src/backend/nodes/bitmapset.c)

2024-01-29 Thread Ranier Vilela
Hi, IMO I believe that bitmapset can obtain an optimization in the calculation of the WORDNUM and BITNUM macros. As you know, in bitmapset, negative members are not allowed. if (x < 0) elog(ERROR, "negative bitmapset member not allowed"); Then, allow the compiler to optimize and do the