-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[.NET 8 & .NET 7] Poor performance in scrolling in the image list. #18877
Comments
I had S23 Ultra with ONE UI 5.0 (android 13.0), and today I updated the phone to ONE UI 6.0 Android 14. The issue about the stuttering seems to be gone for now for the example project on my phone. I didn't mention earlier that there is another scrolling issue. It still seems to be continuing. I will try to share an example app that will demonstrate the other issue as soon as possible. |
I have a Similar issue with CollectionView using GridItemsLayout and Images: #18881 |
@mjsb212 I find a workaround solution that will work if you don't update the collection view after adding the images. The solution is to wrap a scollview component. This way, the scrolling event is controlled by the scrollview which works better in my opinion. However, if you update the collectionview frequently then the stutter might start again after some point even if you are using a scrollview. It means that the srollview has the same problem probably as the collection view.
|
@cropyai Thanks, but unfortunately in the official API docs it notes that CollectionView should never be put inside a ScrollView, CollView has its own scroll events & its purpose is to handle the items scrolling and list virtualization -- But if that workaround stops the problem then im thinking there is most likely a problem in the Android recycle view implementation, & so hoping they will fix it soon. I believe @jonathanpeppers made note of the issue and will look into it after Vacation/Holiday. If anyone has any more input please keep us updated! |
Hi @cropyai. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@jonathanpeppers @mjsb212 The problem is not related to the scroll view. I removed the scrollview component (it was just a coincidence that the code had scrollview). The problem still occurs in both debug & release modes. |
We were reading the example code here that uses a |
@jonathanpeppers I am uploading a video about this which is exactly the same case happening in our production app. |
@jonathanpeppers here is the video. I recently opened 3-5 issues in this repo. So, If I remember correctly these components call loaded event everytime they reappear in the collectionview. (Now without scrollview, the stuttering lagging issue seems to be gone, but the other issue is still there) x4.mp4 |
@jonathanpeppers please read my comment on #18881 . My comment was as below: @jsuarezruiz @jonathanpeppers as you see above, I have the same similar issue referenced. I can also share some experience with another problem. It only happens in specific design in xaml. I have a Contentview which contains some texts and an image. I am using this contentview template in the collection view. When I add enough amount of images and then do scrolling, as content views appear with the scroll, I see a reloading effect for each image. If I am remembering correctly, the loaded event is called for each content view again & again while scrolling. So, it appears that the collectionview is constantly creating new templates and initiate them again and again for each scroll. I don't know where the old templates go. If I configure xaml page like below:
Then the result is this: x.2.mp4 |
Verified this issue with Visual Studio 17.10.0 Preview 4(8.0.20). Repro this issue on Samsung S22 (api33) devices. |
The first issue I see is: <Image
WidthRequest="120"
MaximumHeightRequest="90"
x:Name="image"
Source="dotnet_bot.png"
Grid.Column="0"
/>
private void ContentView_Loaded(object sender, EventArgs e)
{
this.image.Source = ImageSource.FromUri(new Uri(Order.ImageUrl));
} So then I looked at the actual images you are using:
This is a 1485x835 image?!? Can you use a thumbnail image that is more appropriately sized for a I would not expect the app to perform well under these circumstances. How could we better show a warning for these large images, so you would have been aware? |
It will be interesting to benchmark this since we have 2 levels of caching that should be happening:
But, if this caching is not happening or the cache is not getting hits, then we need to investigate. Is there a perf trace so we can see where the slow things are? Maybe the layouts are doing extra work because sometimes once the image is loaded, a fresh layout pass has to run toi resize the image view to the size of the image. One way to test would be to set a fixed with and height on the image view and then try scrolling. Also, make sure you are testing without the debugger attached as hot reload does get in the way of things to keep VS refreshed. |
No, we don't replace the images. I just want to display N images in a list. It shouldn't matter if they are big or small images. If they are big, so what? Can't I just display big images which is around 720p or 1080p? At the end of the day, a phone shouldn't stutter when viewing images like that. |
Since David Ortinau said he could help fix our company app bugs here I sent him an email as he promised to provide support. No reply from him for months. We have just moved on from using .NET MAUI to ReactNative. Disappointing again |
My comment is actually suggesting:
The large images would be ok, if the rows were sized appropriately (height close to the actual image). Low-end Android GPUs only have about 2x the space to fit their screen resolution. |
Description
Hi,
I prepared an example project. You can find it below:
MauiApp10.zip
The problem with this project is that while scrolling the images, the animation or scrolling is not smooth enough. The frames are stuttered even though I have a device with Snapdragon Gen 2 which is the most powerful processor. This is happening in .NET 8 and also was happening in .NET 7 as well. It is too bad that we just cannot scroll a list of images.
Video
Here is an example video showing the issue below. The video does not show how severe the stutter is. By looking at the real phone with naked eyes, the poor performance is much much more noticeable.
x3.mp4
Code
I used Binding to create this example project.
OrderCard ContentView:
MainPage:
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android, I was not able test on other platforms
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: