From f4e031c662a6b600b786c4849968a099c58fcce7 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 28 Nov 2014 13:37:25 -0500 Subject: Add bms_next_member(), and use it where appropriate. This patch adds a way of iterating through the members of a bitmapset nondestructively, unlike the old way with bms_first_member(). While bms_next_member() is very slightly slower than bms_first_member() (at least for typical-size bitmapsets), eliminating the need to palloc and pfree a temporary copy of the target bitmapset is a significant win. So this method should be preferred in all cases where a temporary copy would be necessary. Tom Lane, with suggestions from Dean Rasheed and David Rowley --- src/include/nodes/bitmapset.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/include/nodes/bitmapset.h') diff --git a/src/include/nodes/bitmapset.h b/src/include/nodes/bitmapset.h index f77060844f..a78ff4886d 100644 --- a/src/include/nodes/bitmapset.h +++ b/src/include/nodes/bitmapset.h @@ -89,6 +89,7 @@ extern Bitmapset *bms_join(Bitmapset *a, Bitmapset *b); /* support for iterating through the integer elements of a set: */ extern int bms_first_member(Bitmapset *a); +extern int bms_next_member(const Bitmapset *a, int prevbit); /* support for hashtables using Bitmapsets as keys: */ extern uint32 bms_hash_value(const Bitmapset *a); -- cgit v1.2.1