Content-Length: 266294 | pFad | http://github.com/postgrespro/postgres/commit/ea7dace2aa21e79a7a8eb23c493bcd2057d9bd7e

1E Simplify/speed up assertion cross-check in ginCompressPostingList(). · postgrespro/postgres@ea7dace · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/ea7dace2aa21e79a7a8eb23c493bcd2057d9bd7e

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy