Filtering freezes UI with large dataset

Grids for WPF Forum

Posted 4 months ago by Ethem Acar
Version: 23.1.4
Avatar

Filtering freezes UI with large dataset.
I have 900k records in treelistview and filtering is unusable. Whole UI freezes and looping trough 900k records takes more than a hour. 😅
Any ideas?

Comments (5)

Posted 4 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The UI-based filtering features of TreeListView will probably not work well with that number of items.  Without something to debug, it's difficult to say what is causing that sizable slowdown, especially that extreme of a delay.  As filter logic adds/removes items, it is triggering updates to the collection that is bound behind the scenes to the TreeListView.ItemsSource collection, which then kicks off native WPF ItemsControl behaviors for adding/removing TreeListViewItem "containers".  You might be able to optimize the filters by adjusting your IDataFilter return values.  For instance, if you return DataFilterResult.IncludedByDescendants, it's going to examine an entire subtree of nodes when a match is not made.  That could add up to a decent amount of time for huge data sets if your filter logic is not extremely quick.  If you know that a subtree cannot pass the filter, it's better to return DataFilterResult.Excluded since that will skip subtree examination and any unnecessary filter logic.

Ultimately, with that enormous number of items in the dataset, you'd probably be better off filtering the data prior to be loaded in UI though.


Actipro Software Support

Posted 4 months ago by Ethem Acar
Avatar

I made an example project:

https://file.io/5kQ84sMabJum

If you like to diagnose & test the problem this source code should be helpful, by making the loops more / less you in LoadData.

Searching "Child" or "SubChild" makes it crash on my pc. Searching "Parent" still kind of works.

Thank you.

[Modified 4 months ago]

Posted 4 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Thank you for the sample.  It appears to be the AutoExpandItemsOnFilter="True" setting in the XAML that triggers the slowness.  As each node is encountered that passes the filter (which in your case is the ~75,000 second tier nodes in the entire tree), it's making sure the ancestors are expanded.  This process of expanding the parents causes TreeListViewItem containers to be generated for every second tier node, and ItemsControl is injecting those.  Due to the sheer number of elements being created and then being inserted in various places in the flat list of items that are visible in the control, that appears to be where nearly all the time is coming from.


Actipro Software Support

Posted 4 months ago by Ethem Acar
Avatar

Hello,

That's good to know, I think I will make a seperate search & find toolwindow. I wonder if i can keep Captures for highlighting but not do any "filtering" which seems to slowdown the treelist. That would be great just can't figure out how to.

Answer - Posted 4 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Filtering and capturing work pretty fast and can be kept.  It's the auto-expand items on filter feature that is the cause of the slowdown in your sample scenario.  The only thing you'd need to change with your sample is removing the AutoExpandItemsOnFilter="True" setting in the XAML and the rest should fully work.  


Actipro Software Support

The latest build of this product (v24.1.2) was released 4 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.