I'm working on a PoC and experience strange performance issues with ListViews.
I can not share code but I try to explain as good as I can
Actually the issues are worst on Android so lets focus on that.
I have a list containing 4!!! Elements. So almost nothing. One element represents a person.
A Person consists of:
His thumbnail photo (original resolution is 96x96) A Photo is stores as an embedded resource into the Xamarin Forms project.
The Role in the company
The phone number
The mobile phone number
The email address
The Location (City)
The office number
To each of this values exists a Label that describes the value, so the description values are just static string references.
Then there is a button to Locate the person on an map and a ImageButton to store the person into your contacts.
Also phone, mobile and mail are bound to a command in order to call or write a mail to the person.
That makes all together 14 Bindings per Item. I mention this because I read somewhere that bindings can slow down the app heavily so I'm not sure if it is the cause of the issue. 14 Bindings per Item equals 56 Bindings for 4 Items + The Binding to the Source of the ListView and as there is an Entry to Search through the list, one more Binding for the Text of the Entry, one Binding for the position to draw on the map and another Binding for the tap outside of the Map to close it. That makes 60 Bindings on my ContentPage. Now is this too much?
What I mean with bad performance
I already managed to improve the performance a bit by using Compiled Bindings, Compressed layouts and cleaned up the Layout generally (replacing StackLayouts with Grid and so on)
However, when the View starts, initially 3 of the 4 persons fit on the screen. If I now scroll down to see the 4th person, I can recongize a small jump/stutter of the list. For this PoC it is fine but if I imagine that later this list would hold over a thousand persons (even if categorized in smaller chunks) I fear of the performance. If there is a small stutter for every person that will appear that was not initially on the list -> Super chaos.
For Android I already switched from ListView to CollectionView, as CollectionView represents a RecyclerView under Android which is supposed to be much more performant than ListView. But even here I see the stutter.
I also tried to remove the image as I thought it might be a problem that the image is loading for the next item but it was not the cause.
So finally, my question is not that specific, but is this normal? Or am I doing something wrong? Are Bindings bad within lists? And if so, how to avoid them? Or what is the trick to make ListViews run smoothly in Xamarin Forms?
Finally you reached the end Thank you for taking the time reading, it is highly appreciated!