pgsql: Pack struct ParsedWord more tightly. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Pack struct ParsedWord more tightly.
Date
Msg-id E1qko7S-005tKP-Vi@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Pack struct ParsedWord more tightly.

In a 64-bit build there's an awful lot of useless pad space in
ParsedWords.  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-order
the fields to avoid unnecessary padding.  alen is only used to
remember the allocated size of the apos[] array, which is not allowed
to exceed MAXNUMPOS (256) elements, so uint16 is plenty of space for
it.  That gets us from 40 bytes to 24 on 64-bit builds, and from 20
bytes to 16 on 32-bit builds.

Per discussion of bug #18080.  Unfortunately this is an ABI break
so we can't back-patch.

Discussion: https://postgr.es/m/1146921.1695411070@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/036297cf1b8490bb72439d9ab471670598d3ad2f

Modified Files
--------------
src/include/tsearch/ts_utils.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Limit to_tsvector_byid's initial array allocation to something s
Next
From: Andres Freund
Date:
Subject: pgsql: docs: Clarify --with-segsize-blocks documentation