[Evaluate] optimize listview controls filling in TVSetup - Channel list for groups (2 Viewers)

Vasilich

Portal Pro
August 30, 2009
3,394
1,170
Germany, Mayence
Home Country
Russian Federation Russian Federation
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.
 

Attachments

  • TVSetup_OptimizeChannelGroupListFill_v2.patch
    7.4 KB

gibman

Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Aarhus
    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
     

    Vasilich

    Portal Pro
    August 30, 2009
    3,394
    1,170
    Germany, Mayence
    Home Country
    Russian Federation Russian Federation
    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 :)
     

    Vasilich

    Portal Pro
    August 30, 2009
    3,394
    1,170
    Germany, Mayence
    Home Country
    Russian Federation Russian Federation
    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 ;)
     

    Attachments

    • TVSetup_OptimizeChannelLists_v1.patch
      233.6 KB

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    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
     

    Vasilich

    Portal Pro
    August 30, 2009
    3,394
    1,170
    Germany, Mayence
    Home Country
    Russian Federation Russian Federation
    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.)?
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    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 ?
     

    Users who are viewing this thread

    Top Bottom