-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
Image animation performance regression on Android #63876
Comments
I also noticed a similar problem. I investigated a bit and and I find out that #58751 is the cause (as you said). I went deeper and I found out that more specifically the engine's commit is this: flutter/engine@f46dde1 (in my case, but I think it applies to you too) I don't use hero animation or InteractiveViewer either, in my case I just render some images and I noticed that comparing 1.19 and 1.20, FPS dropped from 60 to 30 (in debug mode I reach 12 FPS!). It happens with an old physical Android 7 device and on an Android 10 emulator (I have not tested it elsewhere). |
Reproducible on the latest master flutter doctor -v
|
I can reproduce this with the attached example app running on a Moto G4. flutter/engine@f46dde1 changes the size of a In this case, the The extra GCs are not helping overall heap usage because the real impact of the underlying The jank disappears if I remove @dnfield Would it make sense to remove images from |
I'm curious about how well the hint_freed patch I just landed will play with this. I think it's fine to remove the image from GetAllocationSize, but we still need to track the external allocation size of the picture (including the image) so we can tell the Dart VM how much it might free if it runs a GC now. @jason-simmons were you able to tell if the GCs were running at idle periods or not? |
Including images in the size of a Picture may overstate the picture's memory usage. The picture may not be the only object holding a reference to the image (possibly because the image is owned by the framework's image cache). If Dart thinks that the size of the picture includes the image's size, then Dart will more aggressively garbage collect the picture. But deleting the picture will not delete the image, and the extra GCs may cause jank. Fixes flutter/flutter#63876
is this already fixed? |
@glennmichaelmejias landed in the engine in this commit flutter/engine#20673. Not sure if it's rolled to the framework yet. |
@jason-simmons do you think this should be a cherry pick candidate? |
Yes - I think this is having a noticeable effect on performance |
Will add the CP request label |
FYI, this rolled into the framework in 9ee552d |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
I noticed a performance regression when switching to the latest stable (1.20). It happens when animating images (for example during hero animation, or when programmatically zooming in/out in something like
InteractiveViewer
). It is particularly noticeable in debug mode, on low-end devices and with larger images (say >5 MB). In profile mode, performances are way better but we can still observe a regression compared to the previous flutter versions.Specifically, this engine roll brought the issue: #58751
but I don't know enough about Skia and the engine to dig deeper...
I made a simple repro project:
https://github.com/deckerst/flutter_image_anim_regression
Here's a video record of this repro built with a recent master commit of Flutter (notice the jank), and another record built with Flutter v1.19.0-3.0.pre (smooth like butter). Both are records from debug mode, because it's easier to see, but as I said there is also a regression in profile mode.
It happens with physical Android devices and emulators. I can't say whether it happens on iOS.
edit: here's a timeline taken in profile mode with current Flutter master, on a Sony Xperia Z5 Compact (E5823):
dart_devtools_2020_8_16-1597547958570000.json.zip
Target Platform:
Android
Target OS version/browser:
7.1.1 (API 25), 10 (API 29)
Devices:
Sony Xperia Z5 Compact (E5823), Samsung Galaxy S10e (SM-G970N)
flutter doctor -v
The text was updated successfully, but these errors were encountered: