ListView performance

DanielLDanielL PLInsider ✭✭✭✭

While testing FormsGallery - ListView demo, I noticed that scrolling isn't too smooth when using a lot of elements. I suppose it's because of ItemTemplate method which creates a new view for every item. Is it possible to use a ViewHolder pattern as described at http://developer.android.com/training/improving-layouts/smooth-scrolling.html ? Or maybe it's a different thing?

Best Answer

«1

Answers

  • EricMaupinEricMaupin USXamarin Team Xamurai

    Which platform? Which Cell type? We extensively do virtualization in the various renders to ensure high performance.

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    The cells are supposed to be virtualized, however I suspect some reloading of the images is going on which might be causing the issue. We will look into it.

  • DanielLDanielL PLInsider ✭✭✭✭

    Thanks. There aren't any images, just ViewCell, StackLayout, BoxView and Label's. My project is heavilly based on lists and I really look forward to use it.

  • RendyDelRosarioRendyDelRosario DOUniversity ✭✭✭
    edited May 2014

    Same Here. Even the sample app ( removing the photo ), and < 20 rows is REALLY sluggish on Nexus 5. There is something wrong there.

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    We have confirmed and accepted the issue, something is weird, it works well for us on some devices and not others.

  • DanielLDanielL PLInsider ✭✭✭✭

    I have tested it on two devices and listviews are not usable on them (Android). When do you plan to release updated version? I really like Xamarin.Forms and would be very happy to use it. Sadly, I need a lot of listview views.

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    I cant give you a release schedule, but I can tell you that we will fix this before you will likely be anywhere near ready to ship.

  • DanielLDanielL PLInsider ✭✭✭✭

    Ok, looking forward to! What if I would like to start first tests within a two weeks? Quote from news "Developer shot because of a laggy interface" :P No risk, no fun :)

  • MiguelRochefortMiguelRochefort USMember

    Could it be that list item binding is done synchronously? Virtualization and recycling is good, but if it takes a long time to apply the binding (especially if done synchronously), it won't be smooth.

    However, asynchronous list item binding - while smooth - might introduce other issues. It might be necessary to improve the performance of the binding engine.

  • EricMaupinEricMaupin USXamarin Team Xamurai

    Could it be that list item binding is done synchronously? Virtualization and recycling is good, but if it takes a long time to apply the binding (especially if done synchronously), it won't be smooth.

    Simply put: the binding system isn't the issue here.

  • DarrenHaligasDarrenHaligas USMember ✭✭

    I second this. I am too seeing this issue on my Nexus 4 running Kit Kat. Ran into many of these issues with Titanium and hoping to avoid that with Xamarin.

    Is this going to be open sourced? It would be great for the community to be able to enhance the framework.

  • jcmm33jcmm33 GBMember

    +1 for it to be open sourced.

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    The problem is 100% in the layout cycle on android guys, we have narrowed down exactly where the problem is and how to fix it (to a degree).

  • DanielLDanielL PLInsider ✭✭✭✭

    Great :) If you could also look at the android toolbar problem I would be very happy. Currently, there's no way of using toolbar on Android with NavigationPage. Topic: NavigationPage and ToolbarItems

  • JoeBoothJoeBooth USMember ✭✭

    Xamarin folks - the performance is better but still not as good enough for us - will this be 100% fixed?

  • EricMaupinEricMaupin USXamarin Team Xamurai

    Xamarin folks - the performance is better but still not as good enough for us - will this be 100% fixed?

    We're still looking at ways to improve it further.

  • MichaelRidlandMichaelRidland AUInsider, University ✭✭✭

    Hi,

    @ermau‌ @JasonASmith‌

    Are there plans to make Xamarin.Forms open source?

    Thanks

  • EricMaupinEricMaupin USXamarin Team Xamurai

    Are there plans to make Xamarin.Forms open source?

    No.

  • KevinFordKevinFord USUniversity, Certified XTC Partners ✭✭✭

    If it is really a problem for you make your own renderer. :)

  • still not usable (at least for us) in newest update :(

  • EricMaupinEricMaupin USXamarin Team Xamurai
    edited June 2014

    Sadly we regressed performance in the 1.1 update with the changes I made to the renderers (sorry!) We'll be fixing this in the next update and will have some further improvements on top of that.

  • DanielLDanielL PLInsider ✭✭✭✭

    ListView with custom CellView is almost non usable with current version. Please test next version with some complex CellViews as a template. Are there any tips to speed things up? What about view.BatchBegin view.BatchCommit methods?

  • EricMaupinEricMaupin USXamarin Team Xamurai

    Are there any tips to speed things up?

    Simply wait. We've fixed the regression along with other improvements for the next update (coming soon), and have some further improvements lined up for v1.2 (they require renderer API changes, so they won't come with v1.1.1).

  • YanDuanYanDuan USMember ✭✭

    Will v1.2 open up some of the internal methods as virtual methods and is there an estimate on when it will be released?

  • JohanDTJohanDT USMember ✭✭

    Hi,

    Any news on a release date for the next update?
    Still experiencing issues when using a custom ViewCell.

  • jeff.albanojeff.albano USMember ✭✭

    We are having the same problems too. Anyone knows any alternative implementation to this aside from using listview? Of course, with the smooth scrolling optimized. Been finding ways to use ViewHolder over cross platform, but i guess it wont be possible (unless create a custom renderer for each platform, which will suck, since we have to maintain 3 codes at a time).

  • MartinRojasMartinRojas ARMember ✭✭

    Doing some research in Xamarin.Forms Lists, i've encountered the same issue regarding performance. Using the same implementation explained in the official docs ( http://developer.xamarin.com/guides/cross-platform/xamarin-forms/introduction-to-xamarin-forms/ ) , i'm having a sluggish scrolling on the list on several devices.

    Me and my team are looking forward for having this bug fixed

  • DanielLDanielL PLInsider ✭✭✭✭

    @MartinRojas Jeff.1884‌ @JohanDT Did you try 1.2.2 pre2 (unstable channel on nuget). It's a lot better than previous version when it comes to ListView bugs and performance.

  • MartinRojasMartinRojas ARMember ✭✭
    edited July 2014

    @DanielL @JohanDT‌ We've tried 1.2.2 pre2 and we couldn't get any positive results yet. Tested on the Xamarin Forms example project 'FormsGallery', where there is an implementation of a custom listview. We've updated to the prerelease from nuget and i said before, the scrolling is still with lags. This lag is present on all platforms supported by Xamarin.Forms (Android, iOS, WP8). Tested on device.

    If there is any other advice, or suggest sth that we are doing incorrectly, we're open to receive any other experiences regarding this issue.

  • EricMaupinEricMaupin USXamarin Team Xamurai

    Without seeing a repro, there's not much I can say in the way of improving how you use it. That said, there are more performance improvements coming.

  • MichalAniskoMichalAnisko USMember ✭✭

    When coming ? I'am testing listview performance with little more complex cell based on viewCell with 5xLabel and 3xImage.
    After deploying into Iphone 4s I think scrolling on my listview is tragedy, sluggish and lots of lags. My row is not very complex, I used much more view and view containers in native Android ListView row and I never had performance problems like here.

    I think ListView control is a key component every mobile platform, and Xamarin.Forms ListView is now so bad - it can target to very simple apps not to complex buisness apps.

    Conclusion is - please fix listview not only promise to do this.

    I use Xamarin.Forms 1.2.3.6249-pre2.

  • MihaMarkicMihaMarkic SI ✭✭✭✭

    I wonder whether the bad performance is due to Images in there. Can you omit images and retest it?

  • MichalAniskoMichalAnisko USMember ✭✭
    edited September 2014

    Yes, I have tested listview without images - it works better but still have small lags.
    But lists are designed to hold images in rows, I can't image not using imagest in list in serious buisness app.

    I think according to Xam Team I should use only one text label in my lists and it will be enough and good for user...

  • MihaMarkicMihaMarkic SI ✭✭✭✭

    Right, I was just wondering whether the lag is due to images, or better, the biggest lag part. I assume Xam is loading images synchronously and thus the lag + forms overhead. But really just guessing.
    And yes, rich lists views are mandatory for a good user experience.

  • EricMaupinEricMaupin USXamarin Team Xamurai
    edited September 2014

    Right, I was just wondering whether the lag is due to images, or better, the biggest lag part. I assume Xam is loading images synchronously and thus the lag + forms overhead.

    Images are loaded asynchronously.

    I'am testing listview performance with little more complex cell based on viewCell with 5xLabel and 3xImage.

    Can I see a code example? EDIT: Nevermind, found your separate thread.

  • MihaMarkicMihaMarkic SI ✭✭✭✭

    Images are loaded asynchronously.

    Good. Do you cache them as well? At the ListView level I mean.

  • CaptainXamtasticCaptainXamtastic GBUniversity ✭✭✭

    Hi Eric, can you give an update here as to the expected 'out-of-the-box' improvement of the ListView in the near future without us having to default to custom renderers?

  • KanwarBadyalKanwarBadyal AUMember

    @ermau I am using ListView with UriImageSource( to use caching of images) in my PCL project. Even for 5 records the images are not showing up . List view shows last two images and skips images for 1st, 2nd and 3rd record. I tried adjusting cache validity but no luck. ListView behavior is not consistent. Further even i tried using same image URI to stream from web and load in list view, it sometime loads in all five records and sometimes just one or two.
    Please suggest.

Sign In or Register to comment.