Re: Question on alignment - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Question on alignment
Date
Msg-id 6475.1554126003@sss.pgh.pa.us
Whole thread Raw
In response to Re: Question on alignment  (Antonin Houska <ah@cybertec.at>)
Responses Re: Question on alignment
List pgsql-hackers
Antonin Houska <ah@cybertec.at> writes:
> Antonin Houska <ah@cybertec.at> wrote:
>> Since palloc() only ensures MAXIMUM_ALIGNOF, that wouldn't help here anyway.

> After some more search I'm not sure about that. The following comment
> indicates that MAXALIGN helps too:

Well, there is more than one thing going on here, and more than one
level of potential optimization.  On just about any hardware I know,
misalignment below the machine's natural word width is going to cost
cycles in memcpy (or whatever equivalent the kernel is using).  Intel
CPUs tend to throw many many transistors at minimizing such costs, but
that still doesn't make it zero.  On some hardware, you can get further
speedups with alignment to a bigger-than-word-width boundary, allowing
memcpy to use specialized instructions (SSE2 stuff on Intel, IIRC).
But there's a point of diminishing returns there, plus it takes extra
work and more wasted space to arrange for anything to have extra
alignment.  So we generally only bother with ALIGNOF_BUFFER for shared
buffers.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Question on alignment
Next
From: Michael Paquier
Date:
Subject: Re: [HACKERS] generated columns