Kodi Community Forum

Full Version: Question regarding optimization and conditional visibility/includes?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Apologies if this is in another thread somewhere, but I was wondering how xbmc handles controls that are hidden, as opposed to controls that are not included because of a conditional include. For example, would there be an optimization hit (in terms of memory, cache, cpu usage) to having a window with a lot of objects "present", but no more than a few actually visible at any one time?
jmarshall is the best to answer but pretty sure anything thats not visible doesn't take up any more memory than the text for the control itself in memory. It doesn't actually start using memory until the images/text are visible for it.
It might of course slow things down with 100's of conditions being constantly checked but not sure of the impact of that.

Note Visible of course mean <visible> tag not somthing made 100% transperant with an animation that still takes up the normal memory
If controls are present then they're a performance hit whether they're visible or not.

Every frame, we check every control for it's visibility. The actual rendering of the control isn't much more than this.

Thus, if you don't need the control, get rid of it.

Cheers,
Jonathan
Thanks!
Interesting, thanks.
Note that, as the original poster indicated, controls that are only included via conditional includes is a different story - if the include condition evaluates false, they're not included, and thus no performance hit at all.

Thus, big blocks of code that don't need to be there all the time should be conditionally included.

Cheers,
Jonathan
And am I correct in assuming that the include condition is only checked upon loading the window and not every frame.
Correct. After all, otherwise there would be no difference between them.

Cheers,
Jonathan