News for hackers. Stuff that matters.
Re:Saving a Third of Our Memory by Re-Ordering Go Struct Fie... by berkut on Monday January 10, 2022 @12:12AM (#29870912)
Not undefined behaviour, but you can get "false sharing" where data from structs/member variables ends up in particular cache lines depending on their address (and the -way of the caches of the processors). Depending on the algorithm and the access patterns it's relatively common (at leasts in HPC space in my experience) to get overhead / inefficiencies due to false sharing or other aliasing issues (4k aliasing on Intel CPUs, although that's arguably a slightly different issue), due to cache line 'collisions' of different member variables being written to in the caches in sub-optimal ways due to the algorthm.

So for HPC code, you very much do want the ability to re-order them manually.

There are no comments on this comment yet.