When I use ExpandAllHierarchyItems to expand all. It take at least 3-4 seconds. Is it possible to improve performance in this operation?
8 Answers, 1 is accepted
I use profiler and found that 70% time systems spends in PopulateInternalList method of QueryableCollectionView.
Also I found that when I collapse or extand only one item. RadTreeListView re-populates internal collection. AS a result expanding only one item take same time as expanding all. It's a huge amount time for me.
For Expand one, I did some additional research and found on each collapse/expand RefreshViewAndParents method of HierarchicalCollectionView is called. This method has following implementation:
private
static
void
RefreshViewAndParents(HierarchicalChildCollectionView childView)
{
using
(IEnumerator<HierarchicalCollectionViewBase> enumerator = childView.SelfParentsAndRoot.GetEnumerator())
{
while
(enumerator.MoveNext())
{
enumerator.get_Current().RefreshCore();
}
}
}
Statemet childView.SelfParentsAndRoot returns two lines:
- Expanding/Collapsing line
- Whole root collection
As a result whole collection is refreshed
PS. I use 2011 Q1
Indeed this is how our RadTreeListView works. The tree list will create a flat collection from your hierarchical data and will manipulate this collection during expand/collapse, sort, filter, etc. Earlier versions of the component used Add and Remove collection changed actions during expand collapse of child items to notify the UI, however this proved to be very very slow and we've changed this to Reset.
Now every time you expand or collapse an item the hierarchical collection will mass remove/add respective child items and will raise Reset collection change in order to notify the container generator that all containers need to be regenerated.
We've started (more than 2 months ago) huge optimization on our data layer (used in both RadGridView and RadTreeListView) related exactly to multiple add/remove operations and we believe that after we plug this completely we may find a way to optimize the expand/collapse of the treelist and the hierarchical collection itself.
The official release of this optimization will be Q2 2011 (middle of July) and we will do our best to provide faster treelist.
Vlad
the Telerik team
But, could you provide recommendations how to tune performance for current vresion. I'm interesting in very special case: two-levels only hierarchy.
Unfortunately currently we cannot offer you any other performance improvements with the current version when you expand all items at once.
Kind regards,Vlad
the Telerik team
It looks like that expand one and expand all costs the same amount of resources.
Please try our latest build for Q2 2011 - the expand all performance will be much better!
Greetings,Vlad
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!
Indeed I'm referring to our latest internal build for Q2 2011.
All the best,Vlad
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!