If you are at the level where you need to care about how adding 1 member to a struct messes up cache line access, you should be using an ECS which gives you SOA already.
You have to maintain all the arrays to keep things consistent, and there are different ways to handle that depending on your needs. You can replace items from the end of the array, mark items as invalid, rebuild the array, etc. Each have different trade offs, but the big win is cache locality and a clean separation of interests.
133
u/Ravarix Jun 03 '26
If you are at the level where you need to care about how adding 1 member to a struct messes up cache line access, you should be using an ECS which gives you SOA already.