I don't think a compiler could ever reliably transpose an array-of-structs representation to a struct-of-arrays one.
There's also other issues with this paradigm, like creating objects out of the arguments to a function.
That not only makes your code less maintainable (what if you need a subset of the variables), but now you'll have to drag all that data to each function you create.
Clean code is, IMO, worthless, data- and domain-driven design practices accomplish the goals of clean code better than it the paradigm itself does, and also improve other considerations like correctness and performance.
>I don't think a compiler could ever reliably transpose an array-of-structs representation to a struct-of-arrays one.
An interesting question, but a SoA isn't necessarily better than an AoS: it depends on the access pattern, so the question is whether this optimisation could be added as a part of PGO..
There's also other issues with this paradigm, like creating objects out of the arguments to a function. That not only makes your code less maintainable (what if you need a subset of the variables), but now you'll have to drag all that data to each function you create.
Clean code is, IMO, worthless, data- and domain-driven design practices accomplish the goals of clean code better than it the paradigm itself does, and also improve other considerations like correctness and performance.