pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Pack struct ParsedWord more tightly.
Date: Mon, 25 Sep 2023 16:07:35 +0000
Message-ID: <E1qko7S-005tKP-Vi@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1qko7S-005tKP-Vi@gemulon.postgresql.org>
Permalink:  ../E1qko7S-005tKP-Vi@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qko7S-005tKP-Vi@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Pack struct ParsedWord more tightly.
  In-Reply-To: <E1qko7S-005tKP-Vi@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox