-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
[PVR] Improve performance of TriggerRecordingUpdate/TriggerTimerUpdate #17140
Conversation
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.
Very nice. This logics was there before I joined the project and I never took a closer look. Thanks.
That would be great. EDIT: Please don't touch EPG as I'm currently doing major changes in this area. |
Understood. Simplification made to remove std::make_pair() and squashed. EPG actually benefits a lot time-wise for operations like right after a "Clear Data" and everything is reloaded by avoiding the deep copy. Here is what I had for that (hasn't tested yet, just did it), will discard and omit from any subsequent PR. Thank you @ksooo!
|
Added suggested changes for PVR::TransferTimerEntry(), as it had the same basic problem. The addition is expected to be negligible time-wise and not be noticeable to an end-user. The remaining non-EPG functions (channels, channel groups, channel group members) are implemented differently and more efficiently. Since EPG was omitted and only Timers came up, I opted to collapse that change into the same PR. LMK if that is not acceptable and I can break them up. |
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.
Perfect. Thank you.
@djp952 this introduces a small regression with recordings. We must ensure that the constructor that creates the recording we reuse in
So, could you please open a PR that inserts the missing call to |
Will do. Thank you for noticing the problem. |
[PVR] Improve performance of TriggerRecordingUpdate/TriggerTimerUpdate
Description
While doing some performance testing on my PVR addon, I noticed that TriggerRecordingUpdate() was taking longer than seemed necessary. Digging into it a bit, I found that the data provided by the PVR addon was being duplicated unnecessarily by deep-copying a shared_ptr<> instance that has no need to be deep-copied.
I think this type of optimization may ultimately also be applicable to other PVR transfers (EPG, Channel Groups, Channels, Timers), but would prefer to see how this PR goes first before recommending any additional changes. Each transfer function is different and may or may not benefit in the same way.
edit: The same type of change only affected EPG and Timers. EPG is in the process of being refactored; so I only added a change for Timers.
Motivation and Context
A measurable (> 40%) performance improvement transferring PVR_RECORDING information from a PVR addon to Kodi. There was little to no associated improvement for the PVR_TIMER information as there will typically be a relatively small number of these.
How Has This Been Tested?
Tested on Windows (Desktop) x64, using recent Kodi 19 "Matrix" nightly build. No functionality issues were detected. I compared the state of the original shared_ptr<> with the deep-copied one and found no discrepancies. Performance increase (less addon overhead) for transferring 922 recording structures dropped from 171ms to 93ms, which is a 45% improvement.
I did not test this PR on Leia branch, and am of the opinion that even if accepted for master branch it's not worth a back-port since no defects have been addressed.
If accepted for master branch, I would be willing to look at the other PVR transfer operations to see if they may benefit some similar optimizations.
Screenshots (if appropriate):
N/A
Types of change
Checklist:
Review by @ksooo is requested if PR builds successfully for all supported platforms.