[Python-ideas] improving C structs layout

random832 at fastmail.us random832 at fastmail.us
Wed May 8 17:55:38 CEST 2013


On Wed, May 8, 2013, at 9:45, Alfredo Solano wrote:
> Hi,
> 
> Interesting observation, but isn't C struct alignment platform/compiler
> dependent? That would mean optimizing the member declaration order for
> one architecture may have a performance hit for another one.

It's platform-dependent, yes, but generally any given platform is going
to either A) not care or B) generally place holes when there are smaller
types before larger types, and not place them when there are larger
types before smaller types. And it's unlikely that you'd get a
performance hit for this, the whole point of the padding is to _not_
have member order impact performance.



More information about the Python-ideas mailing list