v2-0001-Change-Bitmapset-from-32-bit-to-64-bits-on-64-bit.patch
application/octet-stream
Filename: v2-0001-Change-Bitmapset-from-32-bit-to-64-bits-on-64-bit.patch
Type: application/octet-stream
Part: 0
Message:
Re: Switching to 64-bit Bitmapsets
Patch
Format: format-patch
Series: patch v2-0001
Subject: Change Bitmapset from 32 bit to 64 bits on 64-bit machines
| File | + | − |
|---|---|---|
| src/include/nodes/bitmapset.h | 15 | 1 |
From 4dc9fcc4c7aa6d1fd7baf60a90a8e60a51aac9df Mon Sep 17 00:00:00 2001
From: "dgrowley@gmail.com" <dgrowley@gmail.com>
Date: Sun, 2 Dec 2018 10:47:56 +1300
Subject: [PATCH v2] Change Bitmapset from 32 bit to 64 bits on 64-bit machines
This can improve allocation performance for when large Bitmapsets are built
incrementally. Performance of skipping zero words in the set also is
improved here. We maintain a 32-bit bitmapword size on 32-bit machines.
---
src/include/nodes/bitmapset.h | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/include/nodes/bitmapset.h b/src/include/nodes/bitmapset.h
index b6f1a9e6e5..74d837faec 100644
--- a/src/include/nodes/bitmapset.h
+++ b/src/include/nodes/bitmapset.h
@@ -29,11 +29,25 @@ struct List;
* Data representation
*/
-/* The unit size can be adjusted by changing these three declarations: */
+/*
+ * Determine the best bitmap word size based on the processor's word size.
+ * 64-bit bitmapwords are faster on 64-bit machines. That's unlikely to also
+ * be true on 32-bit machines, so let's keep them 32-bit for those.
+ */
+#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
+
#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 */
--
2.16.2.windows.1