Add bms_next_member(), and use it where appropriate.
Tom Lane <tgl@sss.pgh.pa.us>
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
Files
| Path | Change | +/− |
|---|---|---|
| contrib/postgres_fdw/postgres_fdw.c | modified | +8 −6 |
| contrib/sepgsql/dml.c | modified | +7 −9 |
| src/backend/executor/execMain.c | modified | +14 −15 |
| src/backend/nodes/bitmapset.c | modified | +63 −5 |
| src/backend/nodes/outfuncs.c | modified | +2 −4 |
| src/backend/optimizer/path/allpaths.c | modified | +2 −4 |
| src/backend/optimizer/path/indxpath.c | modified | +2 −4 |
| src/backend/optimizer/util/joininfo.c | modified | +4 −8 |
| src/backend/optimizer/util/var.c | modified | +2 −4 |
| src/backend/rewrite/rewriteHandler.c | modified | +3 −5 |
| src/backend/rewrite/rewriteManip.c | modified | +2 −4 |
| src/include/nodes/bitmapset.h | modified | +1 −0 |
| src/pl/plpgsql/src/pl_exec.c | modified | +4 −8 |