Posts: 274
Joined: Apr 2009
Reputation:
0
Leeuw
Senior Member
Posts: 274
2009-07-03, 04:32
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?
Posts: 5,292
Joined: Jun 2006
Reputation:
62
Jezz_X
Team-XBMC Skinner
Posts: 5,292
2009-07-03, 05:22
(This post was last modified: 2009-07-03, 06:03 by Jezz_X.)
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
Posts: 26,215
Joined: Oct 2003
Reputation:
187
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
Posts: 26,215
Joined: Oct 2003
Reputation:
187
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
Posts: 17,418
Joined: Aug 2007
Reputation:
590
Hitcher
Team-Kodi Member
Posts: 17,418
And am I correct in assuming that the include condition is only checked upon loading the window and not every frame.
Posts: 26,215
Joined: Oct 2003
Reputation:
187
Correct. After all, otherwise there would be no difference between them.
Cheers,
Jonathan