Make Bus much more memory efficient#58
Merged
mitchmindtree merged 2 commits intoRustAudio:masterfrom Jul 17, 2017
Merged
Conversation
Previously a `Bus` would require a unique `VecDeque` for keeping pending frames for each `Output`. It also did not provide a way of removing outputs, meaning busses with a growing number of outputs would infinitely grow in memory usage. This new implementation only requires a single VecDeque for pending frames, regardless of the number of outputs. Instead, we just store a HashMap from the output's unique key to its current index into the pending frames buffer. Outputs now also implement Drop and will remove themselves from the HashMap. It will also drain the front of the front of the buffer and update the buffer indices for each of the outputs if the removed output was the "latest" to receive frames.
Member
Author
|
Ahh seems like HashMap isn't provided from the |
Member
Author
|
|
mitchmindtree
added a commit
to mitchmindtree/dasp
that referenced
this pull request
Sep 7, 2017
This publish includes: - Signal Map and ZipMap RustAudio#68 - impl Signal for Box<Signal> RustAudio#67 - Change Signal::next return type from Option<Frame> to Frame RustAudio#57 - Make `Bus` more memory efficient RustAudio#58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously a
Buswould require a uniqueVecDequefor keeping pendingframes for each
Output. It also did not provide a way of removingoutputs, meaning busses with a growing number of outputs would
infinitely grow in memory usage.
This new implementation only requires a single VecDeque for pending
frames, regardless of the number of outputs. Instead, we just store a
HashMap from the output's unique key to its current index into the
pending frames buffer.
Outputs now also implement Drop and will remove themselves from the
HashMap. It will also drain the front of the buffer and
update the buffer indices for each of the outputs if the removed output
was the "latest" to receive frames.