home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Using reflection for GUIControlFactory
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="NoMoDo" data-source="post: 4187" data-attributes="member: 10381"><p><strong>Weeeeeeeeee.</strong></p><p></p><p>@Suicidal - Thank you for your wise and insightful suggestion. </p><p>I've decided it to do it myself, and worked frantically over the last three days.</p><p>My implementation is about 96% done. In fact, I have MP loading using the re-written-from-scratch GUIControlFactory. If I'm not just insanely sleep deprived and imagining things, I think this change of architecture has brought us some significant performence improvements (NProf thinks so too, but I should really do more testing to be sure).</p><p></p><p>The way I did it was to simply let GUIControlFactory set the values on the private fields on the control. Each of these private fields was maked with a "XMLSkinElementAttribute", which contains the name of the corresponding element in the xml. </p><p></p><p>More about the performence aspect of this change: My testing shows that using reflection to set a value on a private field of a class is only about 6 to 8 times longer than a regular assignment to a private field member. Of course, there's the additional cost of reflecting the GUIControl class to find all of it's skinnable fields, but that is only done once per control (using a Hashtable as a cache), so that cost is totally insignificant.</p><p></p><p>I'd also like to stress that while this may seem like a huge change that might introduce problems, I did do my part to try and make sure nothing goes wrong - as I changed the controls incrementally to use my "new way", I made sure they can still be created by the "old" GUIControlFactory - and ran MediaPortal and made it create two instances, one using old Factory class and one using the new one, and used a class I wrote called "InstanceComparer" that logged any differences between the two. If there were any, I fixed my changes. So I guess you could say I did my part for software testing.</p><p></p><p>I think I'll have my patch up on sourceforge by tomorrow.</p></blockquote><p></p>
[QUOTE="NoMoDo, post: 4187, member: 10381"] [b]Weeeeeeeeee.[/b] @Suicidal - Thank you for your wise and insightful suggestion. I've decided it to do it myself, and worked frantically over the last three days. My implementation is about 96% done. In fact, I have MP loading using the re-written-from-scratch GUIControlFactory. If I'm not just insanely sleep deprived and imagining things, I think this change of architecture has brought us some significant performence improvements (NProf thinks so too, but I should really do more testing to be sure). The way I did it was to simply let GUIControlFactory set the values on the private fields on the control. Each of these private fields was maked with a "XMLSkinElementAttribute", which contains the name of the corresponding element in the xml. More about the performence aspect of this change: My testing shows that using reflection to set a value on a private field of a class is only about 6 to 8 times longer than a regular assignment to a private field member. Of course, there's the additional cost of reflecting the GUIControl class to find all of it's skinnable fields, but that is only done once per control (using a Hashtable as a cache), so that cost is totally insignificant. I'd also like to stress that while this may seem like a huge change that might introduce problems, I did do my part to try and make sure nothing goes wrong - as I changed the controls incrementally to use my "new way", I made sure they can still be created by the "old" GUIControlFactory - and ran MediaPortal and made it create two instances, one using old Factory class and one using the new one, and used a class I wrote called "InstanceComparer" that logged any differences between the two. If there were any, I fixed my changes. So I guess you could say I did my part for software testing. I think I'll have my patch up on sourceforge by tomorrow. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
Using reflection for GUIControlFactory
Contact us
RSS
Top
Bottom