pgsql: Avoid statically allocating formatting.c's format stringcaches.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Avoid statically allocating formatting.c's format stringcaches.
Дата
Msg-id E1gCSsL-0000wT-LX@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Avoid statically allocating formatting.c's format string caches.

This eliminates circa 120KB of static data from Postgres' memory
footprint.  In some usage patterns that space will get allocated
anyway, but in many processes it never will be allocated.

We can improve matters further by allocating only as many cache
entries as we actually use, rather than allocating the whole array
on first use.  However, to avoid wasting lots of space due to
palloc's habit of rounding requests up to power-of-2 sizes, tweak
the maximum cacheable format string length to make the struct sizes
be powers of 2 or just less.  The sizes I chose make the maximums
a little bit less than they were before, but I doubt it matters much.

While at it, rearrange struct FormatNode to avoid wasting quite so
much padding space.  This change actually halves the size of that
struct on 64-bit machines.

Discussion: https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fd85e9f78d44f0f36776e644380ada077451c992

Modified Files
--------------
src/backend/utils/adt/formatting.c | 94 +++++++++++++++++++++++---------------
1 file changed, 56 insertions(+), 38 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: pgsql: Correct constness of system attributes in heap.c &prerequisites
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix mis-backpatch of c015ccb306ec81bca3023818c9cf0113cae25be1.