xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Enhancement] improve collectionview performance of scrolling #11483

Open jingliancui opened 4 years ago

jingliancui commented 4 years ago

When CollectionView default instance Scrolling ,it is choppy . I found some one has been improve this control via DataTemplateSelector and Mono Nursery Size Please see it here: https://codetraveler.io/2020/07/12/improving-collectionview-scrolling/?utm_campaign=Weekly%2BXamarin&utm_medium=email&utm_source=Weekly_Xamarin_268 I think it is possible to improve the collectionview performance of scrolling. Thanks.

ValonK commented 4 years ago

The performance can be improved by either removing the Bindings or using compiled bindings & the Nursery Size Setting on Android depends on the App, so this has nothing to do with CollectionView

jingliancui commented 4 years ago

@ValonK Maybe team could update the Microsoft Documents of CollectionView about use these settings for performance.

brminnick commented 4 years ago

Adding @roubachof's investigation demonstrating how the GC continues to grow as CollectionView scrolls on Android: https://www.sharpnado.com/gittrends-lags/

MitchBomcanhao commented 4 years ago

I've just tried switching over from ListView to CollectionView and scrolling performance is atrocious.

MitchBomcanhao commented 4 years ago

The performance can be improved by either removing the Bindings or using compiled bindings & the Nursery Size Setting on Android depends on the App, so this has nothing to do with CollectionView

I've switched the layouts to not have bindings in the datatemplates as per the example in https://codetraveler.io/2020/07/12/improving-collectionview-scrolling. It is still unusable... the old list view works considerably better.

Phenek commented 3 years ago

@samhouts Do we have news about this issue. Do MAUI will resolve this?

Kalyxt commented 2 years ago

Not really. I tried MAUI CollectionView GA1 (on android), with positive expectations and it is even worse than Xamarin CollectionView. -500 items with 2 labels... very laggy on scrolling I don't understand how this is still a thing

jingliancui commented 2 years ago

@PureWeen @Redth Hello, are there any progress about this issue on maui ?

roubachof commented 2 years ago

A must read for all of those having lag issues with collection views: https://www.sharpnado.com/xamarin-forms-maui-collectionview-performance-the-10-golden-rule/

tranb3r commented 2 years ago

A must read for all of those having lag issues with collection views: https://www.sharpnado.com/xamarin-forms-maui-collectionview-performance-the-10-golden-rule/

Thanks, however it doesn't explain/solve the poor performance of a collectionview on the first scroll, which is really annoying: https://github.com/xamarin/Xamarin.Forms/issues/14233

roubachof commented 2 years ago

well you might want to check rules 2&3 for this one.

Kalyxt commented 2 years ago

A must read for all of those having lag issues with collection views: https://www.sharpnado.com/xamarin-forms-maui-collectionview-performance-the-10-golden-rule/

First rule should be - Wrap entire DataTemplate with Frame.

roubachof commented 2 years ago

🤔

jingliancui commented 2 years ago

Interesting that between implement of xamarin.forms, maui and Sharpnado.CollectionView:

forms: public class CollectionViewRenderer : GroupableItemsViewRenderer<GroupableItemsView, GroupableItemsViewAdapter<GroupableItemsView, IGroupableItemsViewSource>, IGroupableItemsViewSource>

maui: public partial class CollectionViewHandler : ReorderableItemsViewHandler<ReorderableItemsView>

Sharpnado.CollectionView: public partial class CollectionViewRenderer : ViewRenderer<CollectionView.RenderedViews.CollectionView, RecyclerView>

I think every team member from these 3 implement way have different consideration right?

jingliancui commented 2 years ago

Or I can think it easy that if Sharpnado.CollectionView can pass all the auto test case from Forms and MAUI ? 😂