Xamarin.Forms icon indicating copy to clipboard operation
Xamarin.Forms copied to clipboard

Bindable layout has performance issue when loading with more than 100 items using item source.

Open ragulsv opened this issue 3 years ago • 2 comments

Description

Bindable layout to generate its content by binding to a collection of 100 items, with the option to set the appearance of each item with a DataTemplate has performance lacking issue.

Steps to Reproduce

  1. Run the sample.
  2. Click the button "Click here".
  3. It takes more than 5 seconds to load.

(or)

  1. Create a simple sample with stack layout.
  2. Bind a Collection of 100 items to the item source.
  3. Load the above page from a button click.
  4. There will be a delay to load the page.

Expected Behavior

Binable layout of 100 childrens need to be loaded without any delay.

Actual Behavior

Binable layout of 100 childrens takes 5 second to loaded.

Basic Information

  • Version with issue: 5.0.0.2196
  • Last known good version: NA
  • Platform Target Frameworks:
    • iOS:
    • Android:
    • UWP:
  • Android Support Library / AndroidX Version:
  • NuGet Packages: Xamarin.Forms
  • Affected Devices: All

Environment

Microsoft Visual Studio Professional 2022
Version 17.3.0 Preview 6.0
VisualStudio.17.Preview/17.3.0-pre.6.0+32728.150
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Professional

Visual C++ 2022   00483-10700-11363-AA356
Microsoft Visual C++ 2022

ASP.NET and Web Tools   17.3.375.53775
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.3.375.53775
Azure App Service Tools v3.0.0

C# Tools   4.3.0-3.22375.15+456937d952ad5c0930293ef32c4fbf8c844a9fef
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio   17.3.20 (3f4cb00)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   6.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Office Developer Tools for Visual Studio   17.0.32616.00
Microsoft Office Developer Tools for Visual Studio

Razor (ASP.NET Core)   17.0.0.2232702+e1d654e792aa2fe6646a6935bcca80ff0aff4387
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.0.62207.04100
Microsoft SQL Server Data Tools

Syntax Visualizer   1.0
An extension for visualizing Roslyn SyntaxTrees.

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools   17.0.10701.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.3.0-3.22375.15+456937d952ad5c0930293ef32c4fbf8c844a9fef
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual C++ for Cross Platform Mobile Development (Android)   17.0.32708.82
Visual C++ for Cross Platform Mobile Development (Android)

Visual F# Tools   17.1.0-beta.22363.4+1b94f89d4d1f41f20f9be73c76f4b229d4e49078
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

VSPackage Extension   1.0
VSPackage Visual Studio Extension Detailed Info

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   17.3.0.295 (d17-3@321c85a)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.3.0.208 (remotes/origin/d17-3@e4f67afef)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   17.2.28 (9b3d244)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   13.0.0.0 (d17-3/030cd63)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: dffa5ab
    Java.Interop: xamarin/java.interop/d17-3@7716ae53
    SQLite: xamarin/sqlite/3.38.5@df4deab
    Xamarin.Android Tools: xamarin/xamarin-android-tools/main@14076a6


Xamarin.iOS and Xamarin.Mac SDK   15.12.0.2 (87f98a75e)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Workaround

https://github.com/ragulsv/BindableLayoutIssue

ragulsv avatar Sep 19 '22 11:09 ragulsv

according to the documentation - https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/bindable-layouts

Bindable layouts should only be used when the collection of items to be displayed is small, and scrolling and selection isn't required. While scrolling can be provided by wrapping a bindable layout in a ScrollView, this is not recommended as bindable layouts lack UI virtualization. When scrolling is required, a scrollable view that includes UI virtualization, such as ListView or CollectionView, should be used. Failure to observe this recommendation can lead to performance issues.

So it seems that what you're getting is exactly what is expected.

MitchBomcanhao avatar Sep 20 '22 11:09 MitchBomcanhao

Failure to observe this recommendation can lead to performance issues. ??? Yes of course , because collection view or listview has higher performance , is real ? I am sorry. I left using maui and xamarin.

uavci94 avatar Nov 02 '23 06:11 uavci94