Performance with loading child items

4 posts, 0 answers
  1. Todd Millett
    Todd Millett avatar
    115 posts
    Member since:
    Jul 2009

    Posted 09 Feb 2011 Link to this post

    I am trying to load the treeview control with a million records both at the parent and at the child level. The treeview has load on demand enabled so at start a million parent items would be created and then when a parent is selected a million child items are added. The loading of parent happens reasonably fast, but the child takes almost 8-10 times it takes to load the parent. Am i missing to set any property or anything?
  2. Todd Millett
    Todd Millett avatar
    115 posts
    Member since:
    Jul 2009

    Posted 09 Feb 2011 Link to this post

    To add the above thread, I have kept IsVirtualizing property = true at the treeview level to improve performance as per your help articles.
  3. DevCraft banner
  4. Todd Millett
    Todd Millett avatar
    115 posts
    Member since:
    Jul 2009

    Posted 09 Feb 2011 Link to this post

    While Debugging, I found that the following line takes the most time : 

    viewItem.Items.Clear();
    viewItem.Items.AddRange(args.ChildItems);

    where viewItem is the selected TreeItem and args.ChildItems are those 1 million child items.
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 14 Feb 2011 Link to this post

    Hello Todd Millett,

    Its expected that loading a new non-root collection is slower operation than loading a root-level collection with the same number of items in it. The deeper you are in the tree, the slower this operation will be since when the tree is virtualized and new items are added every parent container must be measured again. 
    On the other hand, it could be the Clear() method that you use or the collection. Do you use List or RadObservableCollection? Could you please test your app with an ObservableCollection?  Additionally, you can send a runnable sample so that we could investigate in depth and advice you better.
    A good approach  of loading on demand could also be found here.

    Greetings,
    Petar Mladenov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top