diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-12-20 12:19:07 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-12-20 12:19:07 -0500 |
commit | 216af5eea5c8fdc9fca9d44da9eec33ac5e002d2 (patch) | |
tree | f99de0205f3b47741f39fe33589f0f99a4fab7d7 /src/include/nodes/bitmapset.h | |
parent | 0c2377152f2b68d46a27d5821a2327b6ca441fca (diff) | |
download | postgresql-216af5eea5c8fdc9fca9d44da9eec33ac5e002d2.tar.gz |
Make bitmapset.c use 64-bit bitmap words on 64-bit machines.
Using the full width of the CPU's native word size shouldn't cost
anything in typical cases. When working with large bitmapsets,
this halves the number of operations needed for many common BMS
operations. On the right sort of test case, a measurable improvement
is obtained.
David Rowley
Discussion: https://postgr.es/m/CAKJS1f9EGBd2h-VkXvb=51tf+X46zMX5T8h-KYgXEV_u2zmLUw@mail.gmail.com
Diffstat (limited to 'src/include/nodes/bitmapset.h')
-rw-r--r-- | src/include/nodes/bitmapset.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/include/nodes/bitmapset.h b/src/include/nodes/bitmapset.h index b6f1a9e6e5..433df8a46d 100644 --- a/src/include/nodes/bitmapset.h +++ b/src/include/nodes/bitmapset.h @@ -27,13 +27,25 @@ struct List; /* * Data representation + * + * Larger bitmap word sizes generally give better performance, so long as + * they're not wider than the processor can handle efficiently. We use + * 64-bit words if pointers are that large, else 32-bit words. */ +#if SIZEOF_VOID_P >= 8 + +#define BITS_PER_BITMAPWORD 64 +typedef uint64 bitmapword; /* must be an unsigned type */ +typedef int64 signedbitmapword; /* must be the matching signed type */ + +#else -/* The unit size can be adjusted by changing these three declarations: */ #define BITS_PER_BITMAPWORD 32 typedef uint32 bitmapword; /* must be an unsigned type */ typedef int32 signedbitmapword; /* must be the matching signed type */ +#endif + typedef struct Bitmapset { int nwords; /* number of words in array */ |