Skip to content

Commit ea7dace

Browse files
committed
Simplify/speed up assertion cross-check in ginCompressPostingList().
I noticed while testing some other stuff that the CHECK_ENCODING_ROUNDTRIP logic in ginCompressPostingList could account for over 50% of the runtime of an INSERT with a GIN index. While that's not relevant to production performance, it's still kind of annoying in a debug build. Replacing the loop around short memcmp's with one long memcmp works just as well and is significantly faster, at least on my machine.
1 parent 7e39b96 commit ea7dace

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/backend/access/gin/ginpostinglist.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,9 @@ ginCompressPostingList(const ItemPointer ipd, int nipd, int maxsize,
266266
{
267267
int ndecoded;
268268
ItemPointer tmp = ginPostingListDecode(result, &ndecoded);
269-
int i;
270269

271270
Assert(ndecoded == totalpacked);
272-
for (i = 0; i < ndecoded; i++)
273-
Assert(memcmp(&tmp[i], &ipd[i], sizeof(ItemPointerData)) == 0);
271+
Assert(memcmp(tmp, ipd, ndecoded * sizeof(ItemPointerData)) == 0);
274272
pfree(tmp);
275273
}
276274
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy