use cached addon menu (cacheToDisc=True) during kodi startup to speed up widgets
#1
If you have
- Skin with a lot of widgets
- widgets that point to plugins rather than library
- low end hardware

Then on startup
- a plugin instance is started for every widget
   - it's possible cacheToDisc of the menus is used sometime but possibly not after 24h?
- These are all started concurrently and so memory load is large and IO high. Low end hardware like firesticks can use USB and this is can be a big slowdown
- Often crashes occur due to hitting a memory ceiling.

I propose
- on startup using the disc cache of the menus (if cacheToDisc=True) regardless of how stale they are
   - some menus don't change that much and something is better than waiting 1-2min for a fresh list
   - assumes more than 2 menus are kept on disc. I've read before that only last and parent menus are cached? If so would need to cache more, even if not used in normal browsing.
- if the menus are stale then after showing the stale version request an update from the plugin in the background
- update the menu/widget once the background plugin has completed
- have a max number of concurrent addons. queue the requests so as not to max out memory. Can be a setting?
Reply
#2
I've updated the description to make the proposal clearer.
One thing I'm not sure on is if there is anyway for kodi to know how to refresh menus/widgets once the updated list has been returned in the background?
Reply
#3
The problem is also aggravated after an object has been played and Kodi returns to GUI. For reasons I cannot fathom, all widgets then seem to refresh the info to build again from scratch. I can understand this for the widget I am currently in, so that an episode or movie can be set to "watched". However, I don't understand why the refresh occurs for all movies, TV, etc. widgets and not just the current one. Maybe the resident wizards can think of a way to optimize.
Reply
#4
(2023-07-31, 17:18)HeresJohnny Wrote: The problem is also aggravated after an object has been played and Kodi returns to GUI. For reasons I cannot fathom, all widgets then seem to refresh the info to build again from scratch. I can understand this for the widget I am currently in, so that an episode or movie can be set to "watched". However, I don't understand why the refresh occurs for all movies, TV, etc. widgets and not just the current one. Maybe the resident wizards can think of a way to optimize.
I think depends on your skin or plugins. I don't get that with my setup. it seems to only refresh the widget I played but I might be wrong. 
The problem is that it's not easy to work out which widget might have changed after playback so a simple plugin might just decide to refresh them all, which is fine on a fast system.

So you are right. limiting the number of refreshes that can happen via plugins at the same time would help on a low end hardware in the after playback use-case.
Reply
#5
I created a bug report on kodi. if anyone knows c++ maybe they can help fix it?

https://github.com/xbmc/xbmc/issues/24110

I've since reaslised that it's more than just keeping around the cache files on startup. json-rpc (which widgets use?) doesn't use the cache, only browsing the plugin directly.
Reply

Logout Mark Read Team Forum Stats Members Help
use cached addon menu (cacheToDisc=True) during kodi startup to speed up widgets0