UraniumUI icon indicating copy to clipboard operation
UraniumUI copied to clipboard

TreeView ineffeciencies causing huge trees to take forever

Open Stryxus opened this issue 1 year ago • 3 comments

I am working on a reverse engineering project with an archive filesystem which has been be translated so I can make use of it with the TreeView control. I have discovered that doing node.Children.Add() causes a graphical update or something else at least which is taking a long time and ends up hanging the application. There arent many children getting added, a 131 child job takes about 30 seconds which is very slow.

I have confirmed this is not my code, it hangs when node.Children.Add() is called.

I have tried setting the Children ObservableCollection directly since it has a setter but, that does not seem to update the control at all.

Is there any chance this could get looked at? Perhaps add an update to the Children setter or, let us call an update ourselves after adding all the Children?

I am still relatively new to MAUI so I cannot contribute to this myself. I am using .NET 8 MAUI on the latest release UraniumUI.

Stryxus avatar Feb 24 '24 16:02 Stryxus

Iv discovered that it takes exponentially longer, the more elements are in the tree.

Stryxus avatar Feb 24 '24 16:02 Stryxus

TreeView uses BindableLayout. Probably bottleneck is BindableLayout itself. https://github.com/enisn/UraniumUI/blob/92fdfd90157e6f065cde26a06a310ad37700b997/src/UraniumUI.Material/Controls/TreeView.cs#L92

But, my first approach while building TreeView was using CollectionView, but using multiple-level CollectionView made the application unusable, its performance was much worse than the current state, and it was crashing randomly while scrolling. I'm not sure how to increase performance but I can build a custom item-recycling logic for BindableLayout

enisn avatar Feb 25 '24 10:02 enisn

Is there something specific about Android? I can quickly load a huge amount on windows, but Android constantly shows me Performing a full GC

mos379 avatar Apr 16 '24 14:04 mos379