Replies: 1 comment 6 replies
-
I have been moving in that direction with things like SIMD support, but that's more for working with all components. I think it depends a lot on the type of operations. Do you have any examples of when SoA tend to be preferred? Going to and from SoA tend to be a zip and unzip routine, which may be better handled by something like |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sometimes when working with colors I want something more like the following, where each component is in its own container.
You might want to operate on only one component at a time and this layout can give a performance benefit by operating on more values at once. Or, you might not care about the order of each container since you're treating it more as data for calculation rather than as individual colors.
I'm usually not concerned about converting from one
Soa
type to another, just that I can get it back to thebase
color type. Converting back to an Array of Structs (Vec<Rgb>
) is not as hard to do for the user as setting up SoA is. It might be nice if some of the base struct's color operations could be derived for theirSoa
counterparts.One drawback to this layout is that a lot of general color operations access all 3 or 4 color struct fields at once. Thus, there's no performance benefit to being in
RgbSoa
overVec<Rgb>
unless you specifically know you need it. This idea might be too niche/large to make sense to maintain.Curious to hear what you think or if you've had any thoughts on this before.
Beta Was this translation helpful? Give feedback.
All reactions