[Approved] Optimized property manager (1 Viewer)

armandp

Retired Team Member
  • Premium Supporter
  • April 6, 2008
    987
    623
    Zoetermeer
    Home Country
    Netherlands Netherlands
    In my quest for speed/resource improvements in mediaportal i came across the property manager and discovered that it literally iterated through every property when it parses input (control labels etc.. ) combined with some unfortunate locking. On slower systems this is causing some problems, and on faster systems this could become a problem when lots of properties are being updated.

    The best solution would be to reinvent the property tags but i leave that to MPII so i made a compatible solution that does not require any changes to existing code and skins. This patch optimizes the process by replacing only the required labels opposed to iterating through ALL labels everytime something needs to be parsed. I also eased the locking part. Ofcourse this means this patch will touch everything in mediaportal and could be considered high risk but from the first tests done by me and several users i can report positieve feedback in terms of a global speedup of mediaportal.

    I already have another topic where i posted a patched core.dll (based on RC1) with this and my other patch implemented.

    Please review the patch carefully. If no serious bugs are discovered i would like to have this implemented rather sooner than later as it can make a huge difference.
     

    Attachments

    • Patch_PropertyManagerOptimalization_25192.patch
      30.8 KB

    Inker

    Retired Team Member
  • Premium Supporter
  • December 6, 2004
    2,055
    318
    Great initiative.

    Small nitpick, several times in your patch you do a (if dict.containskey(key) [...] val = dict[key]). While dict access is O(1) it would still be faster to use dict.TryGetValue instead to save that one extra lookup. More importantly though, from what I can see, this gets rid of at least 2 locks since they are no longer needed.

    Just saying if youre hunting for speed. Let me know if it helped any.
     

    armandp

    Retired Team Member
  • Premium Supporter
  • April 6, 2008
    987
    623
    Zoetermeer
    Home Country
    Netherlands Netherlands
    • Thread starter
    • Moderator
    • #5
    yeah gibman also responsed with the same tip in my other patch i will update both patches with TryGetValue as we can use every speed increase we can :) SO chemelli expect another update to this patch (or probably a patch to the committed revision). I'm currently on holiday (only checking mail and forum lol) when i get back on friday i will update both patches :)
     

    gibman

    Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Usa
    Home Country
    Ethiopia Ethiopia
    arman, Ive already committed those changes.
    Please review :)

    Also removed dead code, comments, and fixed tabs and brackets {} to match our coding convetion.

    and thanks again.

    /gibman
     

    Users who are viewing this thread

    Top Bottom