On Wed, Mar 29, 2023 at 08:11:40PM +0700, Hairy Pixels via fpc-pascal wrote: > > > > On Mar 29, 2023, at 1:33 PM, Sven Barth via fpc-pascal > > <fpc-pascal@lists.freepascal.org> wrote: > > > > No, array types are defined as never having padding between the elements. > > You need to make sure that the element is appropriately sized then. > > > > Wouldn’t that be better for performance if each element was padded to align > with the cache? That seems like something the compiler could do easily for > you behind the scenes. I may not understand the need to "align the elements > on the cache” though.
I do not think you would like to have everything aligned to the cacheline. This use-case requires it because each element in the array will be accessed from a different CPU and you would try to prevent cache ping-pong, i.e., sharing the same cacheline between different cpu's cache. Matias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal