[Proposal] "Structure of Arrays" support #10063
Replies: 5 comments 11 replies
-
How would this work? Also, this seems highly problematic. NOw that there are actually multiple arrays, anyone expecting reasonably behavior as if there was one, will now have that broken. For example, an atomatic compare/swap on an array will not hit all the SOAs. |
Beta Was this translation helpful? Give feedback.
-
|
Could just be a code generator that finds [SoA] attributed structs and produces helper collections that contain decomposed objects? |
Beta Was this translation helpful? Give feedback.
-
Further, while |
Beta Was this translation helpful? Give feedback.
-
|
SoA will require the type carrying the size used for instantiation so that the memory layout can be determined at compile time, which is fully covered by #7508 |
Beta Was this translation helpful? Give feedback.
-
|
Perhaps would be a better syntax for declaring one |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is pre-pre-pre-alpha proposal for Structure of Arrays support in C#. SoA is preferred over AoS for performance reasons, and it would be huge advantage for C# language to support this with low- or no-cost for programmer.
Any design of this idea is suitable if it does not lead to additional difficulties for the programmer. I want to suggest two drafts, both has a lot of troubles to be implemented, and I hope lang designers and runtime engineers will suggest more viable designs.
First draft.
Mark the type with some special attribute
and then every
T[]in the codebase will use SoA instead of AoS:Second draft.
The first draft is an ideal one, because it is support arrays which size is defined in runtime. The second draft is a "fallback" design if the ideal one is impossible to implement.
I understand that this idea is very complex for lang and runtime (ref tracking for GC etc), and I does not involved in runtime development and lang design, so I only hope someone more knowledgeable will be able to make a more detailed proposal.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions