-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Data Oriented Design? #2078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Could I clarify meaning of milestone?
Or,
|
Hi @dzmitry-lahoda, I put this issue as 1.1.0 because it is a broad discussion topic with no actionable content. Are you intending to discuss the Struct of Arrays use case in particular? Are you proposing a specific feature or asking about the existence of a specific feature? |
Is this a dupe of #1214 ? |
|
#383 (comment) seems very relevant. @andrewrk i have look into zig documentation for dod, soa, aos, and found nothing relevant. than i searched dod in issues, but forget to search for soa and aos (at least no issues with such title). I have asked about awareness and possible future existence of soa/aos/dod like stuff, so I can start learn zig now with chances it will go the road i like. Seems there are couple of stories relevant, so Documentation contains packing and data alignment items (as these are expected for C). These are "part of dod" and seems covered. Thanks. |
The choice of SoA and AoS can have a considerable impact on assembly output, as well in many cases, overall performance improvements and developer joy as SoA is naturally suited to SIMD. Consider the following example: https://ispc.godbolt.org/z/OW_WmK from the following discussion: https://twitter.com/pbrubaker/status/1127142640556732417. Arseny has an interesting counter (let the programmer have intrinsic access for optimal performance). JAI at one point had a #SOA compiler directive to force the layout of the struct while preserving access syntax which alleviates the general tire of the a[i].y -> a.y[I] transform when making data layout changes, but lately Jon expressed a different way of handling this but hasn't elaborated any further. |
On SoA vs AoS, #2255 seems relevant. |
ExampleThere is Bosque language interesting features:
So it has kind of struct inheritance with flattening constructors into one. It uses named updates of data to allow backward compatible code changes of adding new fields. It has some kind of convenience of updating data in bulks and shortcuts for handling option type. Why these are DOD related?Such features will allow me to type less and make changes faster and have more reuse with no lost of performance when I try to work with data (like move field from one struct to another, or do updates). Why these may be related to Zig?I guess Zig has no story for struct polymorphism fully defined, so OthersI guess these features can be imitated in C++, may be Rust has such stuff either. I guess Bosque will give APL like features to masses (this may be not related to Zig). |
Any special features to allow to use Zig in data oriented stuff?
In short, as I understand this,
If I have struct A with Foo, and B with Bar.
Than if I have C which references A and B then C has Foo and Bar in code (but still references other memory allocated for A and B).
From code perspective, C may hold-have Foo and Bar directly, or reference A and B. Code to get Foo and Bar from C is same in any case.
Like Data-Oriented Demo: SOA, composition or via C++ templates.
I am asking it because Zig is very good, at least looks like that. And build in DOD seems suits it.
The text was updated successfully, but these errors were encountered: