-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
PollingControlProxy #1717
PollingControlProxy #1717
Conversation
can ControlProxy inherit ControlProxyLt to prevent the code duplication? |
Yes, I have not done it to avoid double inheritance. Should I change it? |
@rryan can we merge this as it is? |
I have just tried to inherit ControlProxy from ControlProxyLt, but that does not work well, because the inherited functions are slots in ControlProxy, so we need to override them anyway. This feels like clutter. |
Now it is even more improved by using a default CO instead of all the null checks. |
Can you elaborate on the use case for this class? What advantage does it have over ControlProxy? I think it would help demonstrate if you modified some existing code to use this new class. |
Yes I can do. I had already a branch that unfortunately does not merge anymore. The main use case was to document "I will not receive Value Change Signals". After the refactoring we will have a clear view which CO needs to receive a signal from the engine. |
What is the importance of not receiving signals? The ControlDoublePrivate still must emit the valueChanged signal. |
Yes, it is mainly a refactoring for readability. I am planning to remove QT's signal slot connections from the engine and therefore it is nice to know which object actually receives signals. The main driver was to deprecate ControlObject::getControl(). Passing a control objects around is insafe and block further refactorings. Later I realized that the Lt variant allows to simplify memory management a lot and saves some CPU cycles. |
Can we use a more descriptive name? To me it's not immediately apparent what |
Ok. |
Thank you for the videos. I hope I find time to watch them completely at the weekend. Is this PR Ok so far? If you agree to the approach I would like to merge this with the preliminary name and do just the renaming in a separate PR. What do you think? |
I don't think "ControlWatcher" quite fits because that implies it is read only. |
Alternatives? I like to emphersise that one receives updates and the other not. Later we may create one, that is connected to the cue out of the engine thread or alternatively automatically check for the source thread and use the queue or not. |
PollingControlProxy works ok for me, however the other one can also poll and it is also not read only. |
Some ideas:
|
Benchmarks for 1000 default constructed objects lifetime (create and destroy): I think we can learn a bit from this:
By the way: Mixxx has 64209 different CO objects and many proxy objects for each of it. |
This PR is marked as stale because it has been open 90 days with no activity. |
689e8dd
to
2eb2d62
Compare
e495f30
to
5eb0bd2
Compare
5eb0bd2
to
f52c95a
Compare
3b697cd
to
e9a3807
Compare
Pull Request Test Coverage Report for Build 1152198391
💛 - Coveralls |
bad9b60
to
43df092
Compare
43df092
to
9fd7153
Compare
Thanks, this looks okay to me. Could you add it to some locations where no signals are needed? Then we could benchmark the startup time to check if it's worth it. |
I have already checked it and the is a performance benefit but it is negligible, compared to other log runners during start up. The main driver for this was the documentation purpose. If we use that everywhere it is possible, we have a clear picture what to do to fix unsafe pointer access and the Qt locking issue when receiving updates. |
LGTM. I too would like to get rid of Control::getControl. |
Thank you for review, and the positive responds :-) |
This is a light weight version of ControlProxy, not inheriting QObject.
It can be used whenever no signals are required and the value is polled.
I wan't to use it to replace ControlObject::getControl, which returns an unsave pointer that can become invalid during shut down and lead to a crash.
The new object is finally just a PIMPL smart pointer and should not be much more expensive compared to ControlObject::getControl
This is now on top of #4229