Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit036297c

Browse files
committed
Pack struct ParsedWord more tightly.
In a 64-bit build there's an awful lot of useless pad space inParsedWords. Since we may allocate large arrays of these,it's worth some effort to reduce their size.Here we reduce the alen field from uint32 to uint16, and then re-orderthe fields to avoid unnecessary padding. alen is only used toremember the allocated size of the apos[] array, which is not allowedto exceed MAXNUMPOS (256) elements, so uint16 is plenty of space forit. That gets us from 40 bytes to 24 on 64-bit builds, and from 20bytes to 16 on 32-bit builds.Per discussion of bug #18080. Unfortunately this is an ABI breakso we can't back-patch.Discussion:https://postgr.es/m/1146921.1695411070@sss.pgh.pa.us
1 parentcf1c650 commit036297c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/include/tsearch/ts_utils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,22 @@ extern void pushOperator(TSQueryParserState state, int8 oper, int16 distance);
8181
*/
8282
typedefstruct
8383
{
84+
uint16flags;/* currently, only TSL_PREFIX */
8485
uint16len;
8586
uint16nvariant;
87+
uint16alen;
8688
union
8789
{
8890
uint16pos;
8991

9092
/*
9193
* When apos array is used, apos[0] is the number of elements in the
9294
* array (excluding apos[0]), and alen is the allocated size of the
93-
* array.
95+
* array. We do not allow more than MAXNUMPOS array elements.
9496
*/
9597
uint16*apos;
9698
}pos;
97-
uint16flags;/* currently, only TSL_PREFIX */
9899
char*word;
99-
uint32alen;
100100
}ParsedWord;
101101

102102
typedefstruct

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp