-
Notifications
You must be signed in to change notification settings - Fork 16
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
AudioParam: Reduce code duplication and Arc usage #296
Conversation
- Extract common fields into AudioParamBase - Extract atomic fields into AudioParamShared wrapped into a single Arc
|
Thanks again. The explicit layout of self.raw_parts
.base_parts
.shared_parts
.current_value
.store(clamped, Ordering::SeqCst);
Do you have any specific ideas or issues to address? It would help me decide whether this new layout pulls its weight |
These chains only appear internally and the actual memory layout is not visible from the outside. Reducing the redundancies upfront might be helpful when sorting out the synchronization between I prefer to group multiple fields that appear repeatedly in different contexts as distinct types. Replicating them anonymously across different types would hide these dependencies. Makes it easier to spot commonalities and differences for subsequent refactorings. We should end up with very few types that share only a single, common core or base. |
Thanks for the elaborate reply.
My question about specific ideas or issues to address still stands. I'm hesitant to refactor for the sake of abstract reasons such as redundancies and commonalities if there is no pressing issue at hand. Surely, you are technically correct about the flat layout hiding possible future improvements, but to refactor also incurs a slight cost since the original authors of the file will have to grok the changes. It would really help me make a judgement if you could share the next steps you have in mind with this module. |
The issues I tried to fix are probably only the tip of the iceberg. |
AudioParamBase
AudioParamShared
, wrapped into a singleArc
The code might not be elegant. But revealing and making those dependencies explicit is the first step before improving the design.
The static decomposition should not have any noticeable impact on performance or memory usage, although the compiler now has less options for reordering and packing the fields. Using only a single
Arc
instead of two could improve performance slightly.