-
Notifications
You must be signed in to change notification settings - Fork 20
Deallocate processors outside render thread #353
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
Conversation
Hey, thanks for getting the conversation started! Some other remarks:
In any case, please proceed. Interesting stuff |
if can_free { | ||
// Node is dropped, remove it from the node list | ||
// remove node from the node list | ||
nodes.remove(index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could say here,
let node = nodes.remove(index).unwrap();
and then move the added section above to here
|
||
/// Method called before the AudioProcessor is recycled, i.e. when sent back | ||
/// to the control thread when its rendering has finished. | ||
fn release_resources(&mut self) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is really tricky..
If a user implements this interface incorrectly and its processor will be reused, very subtle bugs will arise...
Or we need a mechanism to only recycle our own nodes
Hey, Actually, the main goal is rather to find a solution to not deallocate the processors in the render thread, sorry for the confusing title. I really think it creates issues that get more apparent with the javascript GC. For example, if we take the The idea of sending the renderers back to the control thread was more to not close the door to an eventual future renderer pooling system, but I have no clear idea of how this could work nor of any eventual perf improvement. I just remember having this conversation w/ Paul saying he implemented such thing in Firefox, but maybe it was a bit late so let's not take this for granted :).
Cool, let me know your ideas, I can try to prototype something Side note: |
Sorry for the delay in response! Perhaps a good experiment would be to replace Unfortunately I'm totally not familiar with napi-rs so I don't know how rust deallocation works together with the NodeJs GC. But I presume we only need to take care of heap-allocated objects (such as I could whip up a prototype if you are unsure what I mean |
Hey, No problem I was in holidays anyway.
Indeed, good idea I will have a try
Hum right, I see what you mean. I will try to have a shot, that seems like a good exercice for me :) Let's close that then |
Hey,
Just to share a (rather dirty) test I've made to drop processors outside the render thread. Very probably not something to merge as is but can be a basis for discussion
Several notes:
AudioProcessor
trait