Alternating rows hurts performance

11 posts, 1 answers
  1. OfficerJoe
    OfficerJoe avatar
    2 posts
    Member since:
    Jan 2011

    Posted 14 Jul 2011 Link to this post

    Hello,

    I am evaluating these controls for my company and so far have been impressed overall. This week, however, I have run into a performance issue that I have not been able to resolve so far:

    I am using the 2011 Q2 RadGridView (have also tried Q1) with data virtualization using a VirtualQueryableCollectionView talking to a WCF service. UI virtualization is on and working properly. I am not using any custom grid, row, or column styles or templates. As soon as I turn on row alternation using AlternationCount = 2, the vertical scroll performance becomes terrible.

    When alternation is off: holding down the "scroll down" thumb scrolls smoothly even as new pages of data arrive and are loaded into the grid.
    When alternation is on: holding down the "scroll down" thumb scrolls smoothly until a page of data arrives; then, the scrolling locks up for a second while the items are loaded into the grid. Reducing the number of items per "page" doesn't affect it (I even tried only loading 1 row at a time).

    Does anyone know of an alternative way to set alternating row background colors that actually performs at a usable level?

    Thank you,
    Joseph
  2. Answer
    Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 19 Jul 2011 Link to this post

    Hello Officerjoe,
    This is a know issue. Setting an alternation requires additional handling especially regarding  operations affecting the count and the order of items - thus the performance hit. We are planning improvements on that for our next official release.
    Meanwhile I  would recommend the following workaround - Please use row style selectors to achieve a similar effect.

    All the best,
    Pavel Pavlov
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. OfficerJoe
    OfficerJoe avatar
    2 posts
    Member since:
    Jan 2011

    Posted 22 Jul 2011 Link to this post

    Hello Pavel,

    Thanks for the workaround. I was able to achieve alternating row background colors using that method, with much better performance than using the built in alternation functionality.

    Thanks,
    Joseph
  4. Antti
    Antti avatar
    23 posts
    Member since:
    May 2011

    Posted 28 Oct 2011 Link to this post

    Hi,

    Could you please inform me on the status of this issue. Is there an official fix coming?

    I cannot find this topic from the fixed issues list of the release history either in Q2 2011 SP1 or Q3 2011 BETA.

    Regards,
    Antti
  5. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 28 Oct 2011 Link to this post

    Hello Antti,

    For the time being the workaround suggested bellow is still the recommended approach .

    Best wishes,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Antti
    Antti avatar
    23 posts
    Member since:
    May 2011

    Posted 28 Oct 2011 Link to this post

    Hi Pavel,

    Thank you for the quick answer.

    Antti
  7. Antti
    Antti avatar
    23 posts
    Member since:
    May 2011

    Posted 03 Nov 2011 Link to this post

    Hi,

    If we use the style selector approach we get a bit better performance than with the alternation count approach. However, there is still some lag when scrolling.

    We use row index to decide if the row in question is an even or odd row. Thus, in the style selector we currently use this code to get the index of the row:
    var index = grid.Items.IndexOf(item);
    

    That  seems to be the performance bottle neck. Is there any faster way to get the index or other way to know if the row index is even or odd? There is the IsAlternate property but setting the AlternationCount on is the reason for the original performance problems.

    Regards,
    Antti
  8. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 07 Nov 2011 Link to this post

    Hello Antti,

    What is the type of the Item ? Can you put an additional property inside ?  The getter of that property should be faster than the index of .
    I can not think of a better approach so far.

    Regards,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  9. Antti
    Antti avatar
    23 posts
    Member since:
    May 2011

    Posted 21 Nov 2011 Link to this post

    Hello,

    We haven't been able to bypass the performance problems with this solution as we cannot add new properties to data items. We consider using grid without virualization.

    Regards, Antti
  10. Thomas
    Thomas avatar
    10 posts
    Member since:
    Feb 2014

    Posted 07 Oct 2017 Link to this post

    Is there any update on this? I have the exact same problem.

    Disable "RowVirtualization" isn't an option, considering the resulting performance loss.

    I did implement my own StyleSelector (as recommended here). However, the performance is still really bad. (While binding to more than 5k items)

  11. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1206 posts

    Posted 11 Oct 2017 Link to this post

    Hello,

    Let us continue the commucnication in the other thread, where you have shared more specific information about you scenario. I will answer there a bit later today. As soon as we bring the topic to conclusion, I will copy the final posts here fore better visibility to the community.

    Regards,
    Ivan Ivanov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top