[Evaluate] - optimize listview controls filling in TVSetup - Channel list for groups | Page 3

Discussion in 'Submit: code patches (MediaPortal/TV-Server/etc.)' started by Vasilich, July 1, 2011.

  1. Vasilich
    • Team MediaPortal

    Vasilich Test Group

    Joined:
    August 30, 2009
    Messages:
    3,389
    Likes Received:
    608
    Gender:
    Male
    Occupation:
    Developer
    Location:
    Germany, Mayence
    Ratings:
    +1,172 / 2
    Home Country:
    Russian Federation Russian Federation
    Show System Specs
    i was disappointed from possibilities of gentle.net - no SQL in SQL, no suffixes for operators (like SELECT DISTINCT), and no support, as further development of gentle is abandoned.



    Still, i found the possibility to write pure SQL queries when using Gentle. So this is my attempt to fix the filling of listviews for channels using dictionaries and pure SQL queries as optimal as possible. I have done it only for tv channel group list, but now it takes 2.5 seconds (instead of 80 seconds originally) for 4600 channels. I think this is an acceptable time i can live with ;)

    mm and gibman (and maybe other MP devs?), please check the patch and tell your meanings before i apply it on all other places working with channel lists.
     

    Attached Files:

  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. gibman
    • Team MediaPortal

    gibman Retired Team Member

    Joined:
    October 4, 2006
    Messages:
    2,998
    Likes Received:
    1,321
    Occupation:
    Developer
    Location:
    Aarhus
    Ratings:
    +1,372 / 0
    Home Country:
    Denmark Denmark
    thx for the patch :)

    you should try and move the SQL related stuff into a proper public method in the tvlibrary class.

    and try and define your generic lists as: IList or ICollection, Ienumerable, Idictionary etc. where possible (the more basic interface the better it is).

    /gibman
     
  4. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,498
    Likes Received:
    4,712
    Ratings:
    +8,175 / 17
    Home Country:
    New Zealand New Zealand
    Hi again Vasilich

    Any updates on this Vasilich?

    mm
     
  5. Vasilich
    • Team MediaPortal

    Vasilich Test Group

    Joined:
    August 30, 2009
    Messages:
    3,389
    Likes Received:
    608
    Gender:
    Male
    Occupation:
    Developer
    Location:
    Germany, Mayence
    Ratings:
    +1,172 / 2
    Home Country:
    Russian Federation Russian Federation
    Show System Specs
    sorry for the delay.
    I am trying to rework my patch to reuse as much code as possible for all parts of TVConfig (e.g. channels, Radio channels, channel groups, manual control (there we have a combobox with all channels),...), but have been busy in real life, and wont finish it until the end of next week.

    Just a side note - it takes now for finished parts of code less than 3 seconds for 4k5 channels :)
     
    • Like Like x 1
  6. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,498
    Likes Received:
    4,712
    Ratings:
    +8,175 / 17
    Home Country:
    New Zealand New Zealand
    Fantastic! :D
    Don't rush yourself. RL is more important.

    mm
     
  7. Vasilich
    • Team MediaPortal

    Vasilich Test Group

    Joined:
    August 30, 2009
    Messages:
    3,389
    Likes Received:
    608
    Gender:
    Male
    Occupation:
    Developer
    Location:
    Germany, Mayence
    Ratings:
    +1,172 / 2
    Home Country:
    Russian Federation Russian Federation
    Show System Specs
    i know that it won't come into trunk in at least 2 weeks, but still..
    reworked version of the patch with optimizations for almost every channel list in TVSetup:
    • Tv/Radio complete channel lists and channel list groups
    • Tv/Radio channel mapping lists
    • Tv/Radio channel combining lists
    • Tv/Radio EPG channel lists
    • Combobox with all channels in Manual control
    Optimization (in my case getting e.g. "All channels" TV group content for 4k5 channels takes now less than 4 seconds instead of 80 in unpatched SetupTV) is done via rewriting of SQL queries and using dictionaries for searching in lists. Another part is the optimized filling of ListViews.
    Almost all this stuff i implemented as several functions and placed them in new file ChannelListHelper.cs

    Other changes:
    • added enumeration ChannelProviderType instead of direct numbers (i hate magic numbers in code)
    • added function to retrieve icon index for a channel from its tuningdetails (again, i hate magic numbers)
    • consolidated radio and tv code (this part contains most of spaces/linefeeds changes in the patch) for easier maintaining of it later
    • added "use for EPG only" to radio EPG channel list (similar to TV list, also see above)
    • added indication of DVB-S2 channels

    I hope that devs also take a critical look to my coding style, and if it doesn't fit to MP - then let me know ;)
     

    Attached Files:

  8. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,498
    Likes Received:
    4,712
    Ratings:
    +8,175 / 17
    Home Country:
    New Zealand New Zealand
    Hi Vasilich

    This patch is ***huge*** - that makes it quite difficult to evaluate. I've looked at parts of it and it seems okay (although there are some additional dependencies between the projects that I'm not so sure about), however it would be better if you could create separate patches for each of the changes. We'd need to do that before committing...

    mm
     
  9. Vasilich
    • Team MediaPortal

    Vasilich Test Group

    Joined:
    August 30, 2009
    Messages:
    3,389
    Likes Received:
    608
    Gender:
    Male
    Occupation:
    Developer
    Location:
    Germany, Mayence
    Ratings:
    +1,172 / 2
    Home Country:
    Russian Federation Russian Federation
    Show System Specs
    i can divide this patch into 3 parts:
    1. enumeration ChannelProviderType instead of direct numbers - it will contain almost a half of the all changed files, with changes like "0" -> "ChannelProviderType.Analog"
    2. consolidated radio and tv code - it will contain mostly changes in spaces and linefeeds plus added "use for EPG only" to radio EPG channel list (similar to TV list)
    3. the rest of the patch as it is mostly reducing (or similar change) of code plus adding of new file ChannelListHepler.

    will that division be ok? Or should i divide also 3rd part into subpatches for every changed settings page (e.g. patch for channel lists, patch for channel list groups, patch for channel mappings, etc.)?
     
  10. jameson_uk
    • Team MediaPortal

    jameson_uk Retired Team Member

    Joined:
    January 27, 2005
    Messages:
    7,258
    Likes Received:
    2,228
    Gender:
    Male
    Occupation:
    Data Warehousing Consultant
    Location:
    Birmingham
    Ratings:
    +2,403 / 0
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    As for 1 just to say there is a patch lying round in team forums for this but never quite got completed (can't remember why now but was under something about adding tuning details for DVB-IP)

    Also I think ChannelProviderType is a bad name as it is not related to a channel or provider. This would be better call TuningDetailType ?
     
  11. mylle

    mylle Portal Pro

    Joined:
    April 14, 2005
    Messages:
    574
    Likes Received:
    54
    Location:
    Denmark
    Ratings:
    +68 / 0
    Home Country:
    Denmark Denmark
    I wanted to try out the patch but the tv-server cannot build with it :(
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!