Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

List view consuming lots of memory on scrolling using xamarin forms for UWP.

shubham14shubham14 USMember ✭✭
edited June 2018 in Xamarin.Forms

We are using Xamarin forms version 2.5.1, In our app, we are using list view for displaying tabular data for that I am using view cells inside data template.
My view cell consists of grid layout that contains 40-45 columns and to display data on the UI I am using 40-45 labels per row.
The issue that I am facing currently is that when I have large data say 2000 records, so when the user scrolls it takes time to render new records to UI that is first black screen comes and then slowly data gets populated to different rows of list view.
Also, memory consumption increases on scrolling up and down the list view. I have also used the Listview Cached strategy to Recycle element but still no improvement. On profiling, I found that new instances of labels keep on getting created which leads to more rendering time and high memory consumption. So how can we optimize the performance of list view so that it works well with large data. Our target platform is Windows 10 UWP and IOS

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    I think you are visualizing too much data. Reduce number of rows and cols
  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    and then slowly data gets populated to different rows of list view.

    Our app pulls LOTS of data... but we don't see much slowly to the populating of data like what I think you're describing.
    Makes me wonder how much work is taking place that may not need to be. There's a lot of times people pull data from databases on every iteration of a loop when once at the start would be the right thing - just as one example of poor practices. Or lots of circular reaction to changes... or 500 OnPropertyChanged event handling causing lots of re-calculation... There's plenty of reasons for excessive processing that could be causing slow data.

    The issue that I am facing currently is that when I have large data say 2000 records,

    You're not trying to deal with all 2000 records at once are you? Clearly you're not showing them all at once. You should be paging your data so you only deal when a page of records at a time.

    45 Labels to a row, 45 rows at a time.
    Maybe a ListView is just the wrong tool. Sounds like a job for DataGrid.

  • shubham14shubham14 USMember ✭✭
    My data is coming from an api and it is binded to observable collection at once no iterations are involved on scrolling. It only occurs on fast scrolling for normal scrolling data is getting rendered properly.
    Yes i can think in the direction of paging so that we can show say some number of records to user.
    Any idea why list view recycling cached strategy doesn't seems to help in this case
Sign In or Register to comment.