dotnet / dotnet/maui

Horrible performance/memory usage with CollectionView depending on size on screen

Open
#12,013 15 comments 3 reactions 0 assignees View on GitHub
area-controls-collectionview perf/general platform/windows s/triaged s/verified t/bug t/perf/9.0.40
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

### Description

I'm developing a small personal app and I decided to try and use MAUI with XAML for it.
It seems like CollectionView (ListView too, tried myself) has some huge issue in performance and memory usage that depends entirely on how big the collection is on screen when scrolling.

Both videos are run on a release version of the app with an i5-10300H as processor on a laptop.

See below video when the collectionview is big.
https://user-images.githubusercontent.com/26706898/206872000-158e0edd-bd07-4826-9a45-a2e10a07562f.mp4

See below video when the collectionview is medium size
https://user-images.githubusercontent.com/26706898/206872003-4d127e55-dc7c-479b-b5a7-6a077df8566a.mp4

It gets even worse when the collectionview is even smaller.

I'm assuming it's choosing how much to cache based on the size of the item on screen and I have not found any way to override that.
Am I doing something horribly wrong? I can't seem to understand how such a simple app can basically destroy a new machine just scrolling a list of items. Even a browser app can do better than this...

### Steps to Reproduce

Open public reproduction project repository and press run. Try to scroll quickly the grid.

### Link to public reproduction project repository

https://github.com/feal87/ReproductionTest.AppForMAUI

### Version with bug

7.0 (current)

### Last version that worked well

Unknown/Other

### Affected platforms

Windows

### Affected platform versions

Windows SDK

### Did you find any workaround?

_No response_

### Relevant log output

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the public ReproductionTest.AppForMAUI repository, run it on Windows, and reproduce the issue by scrolling its CollectionView grid at different sizes. Compare the performance and memory behavior with the CollectionView and ListView cases described in the report. Done means the reported excessive performance and memory usage is explained and no longer occurs during scrolling.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.