This is a migrated thread and some comments may be shown as answers.

Performance with loading child items

3 Answers 65 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Todd Millett
Top achievements
Rank 1
Todd Millett asked on 09 Feb 2011, 11:47 AM
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?

3 Answers, 1 is accepted

Sort by
0
Todd Millett
Top achievements
Rank 1
answered on 09 Feb 2011, 11:48 AM
To add the above thread, I have kept IsVirtualizing property = true at the treeview level to improve performance as per your help articles.
0
Todd Millett
Top achievements
Rank 1
answered on 09 Feb 2011, 12:10 PM
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.
0
Petar Mladenov
Telerik team
answered on 14 Feb 2011, 05:17 PM
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>>
Tags
TreeView
Asked by
Todd Millett
Top achievements
Rank 1
Answers by
Todd Millett
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or