pgsql: Reduce size of CompactAttribute struct to 8 bytes

Поиск
Список
Период
Сортировка
От David Rowley
Тема pgsql: Reduce size of CompactAttribute struct to 8 bytes
Дата
Msg-id E1w2JqB-0006BR-2q@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Reduce size of CompactAttribute struct to 8 bytes

Previously, this was 16 bytes.  With the use of some bitflags and by
reducing the attcacheoff field size to a 16-bit type, we can halve the
size of the struct.

It's unlikely that caching the offsets for offsets larger than what will
fit in a 16-bit int will help much as the tuple is very likely to have
some non-fixed-width types anyway, the offsets of which we cannot cache.

Shrinking this down to 8 bytes helps by accessing fewer cachelines when
performing tuple deformation.  The fields used there are all fully
fledged fields, which don't require any bitmasking to extract the value
of.  It also helps to more efficiently calculate the address of a
compact_attrs[] element in TupleDesc as the x86 LEA instruction can work
with 8 byte offsets, which allows the element address to be calculated
from the TupleDesc's address in a single instruction using LEA's
concurrent shift and add.

Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAApHDvodSVBj3ypOYbYUCJX%2BNWL%3DVZs63RNBQ_FxB_F%2B6QXF-A%40mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/access/common/tupdesc.c | 12 +++++++++++-
src/backend/executor/execTuples.c   | 17 ++++++++++++-----
src/include/access/tupdesc.h        | 16 ++++++++--------
3 files changed, 31 insertions(+), 14 deletions(-)


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