-
Notifications
You must be signed in to change notification settings - Fork 235
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
Tracking issue for redesigning the Sink API #619
Comments
I think having This also allows extension in the future to perform acts upon the specific sound, if that's desired, as well. You can have this type take |
We might not strictly need an append with interest since there is EmptyCallback. You could append this to the sink after the sound of interest then you would get a callback fired when the source is done. This is hard to find, so some documentation effort may be needed. Even then it might be worth wile handling this in the sink via an |
A problem I see with the Sink implementation is that forces to have all the functions embedded every time even if users do not need them. So maybe that makes I think, atomics can be used to control parameters without using a periodic callback. For |
Ahh yes, that could possibly slow down code. I thought of that a while back one of the solutions I came up with is to make Sink generic over a ton of const generic parameters like
Users do not see this though, and I do not really mind it (but it does look funny when you see it for the first time).
They could, and that are probably fast enough. On x86 using Relaxed ordering it should even be the same. On arm there is a difference. Since its about half a million atomic reads per second! It should definitely be bench-marked. Would require a lot of work especially since you need to do it for multiple cpu-architectures. What will probably wreck performance is using Arc. That is going to ruin cache locality and the optimizer also gets limited in what it can do.
Nice trick, every Source getting a generic parameter is a bit scary though. We could always solve that by having |
I am not sure that cache locality will be a problem since the value behind the |
Oh no thats not what I meant, just that on some platforms there is are atomics but they are slower.
Or 6 cache line's that is not in the hand of the allocates and where it found space for 6 small values that might not necessarily have been created at the same time. I don't know.
Right now access does involve de-referencing a pointer. Since the variables are currently stack allocated the compiler can more easily apply a ton of optimizations. |
I have enjoyed our conversation today :) Its very nice to discuss this in depth. It is getting rather late here so I am going to call it for now. I wish you a very good night, and I look forward to reading more 👍 |
I have thought about this some more and its really something we should try. It will allow users to modify sources that are being mixed separate, something that is impossible now. Could you open an issue for this (since its your idea, credit goes to you)? Then we can discuss it further there. Ill see if I can add a benchmark suite to rodio to make it easy to measure the performance impact. |
We should also look into benching atomic_float and |
some ideas for optimizations in case we try atomic controls:
alternative for atomic controls
if atomic controls are not fast enough & alternatives do not work
let (controls, source) = source.with_controls().speed(spd) we could combine that last option with the slab allocater by requiring |
There are currently two seperate PR's that expand on the Sink's functionality to be more easily used as a 'playlist':
SourcesIdQueueInput
that allows manipulating items in the queue #506This issue is to discuss a new Sink which supports both those applications, maybe by merging those PR's or by making breaking changes to the current Sink.
This should take #613 into account.
The text was updated successfully, but these errors were encountered: