[go: nahoru, domu]

Skip to content
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

OpenContainer jank due to multiple frames of shader compilation #76180

Closed
danReynolds opened this issue Feb 17, 2021 · 75 comments
Closed

OpenContainer jank due to multiple frames of shader compilation #76180

danReynolds opened this issue Feb 17, 2021 · 75 comments
Labels
c: performance Relates to speed or footprint issues (see "perf:" labels) c: rendering UI glitches reported at the engine/skia rendering level customer: crowd Affects or could affect many people, though not necessarily a specific customer. engine flutter/engine repository. See also e: labels. P1 High-priority issues at the top of the work list perf: speed Performance issues related to (mostly rendering) speed platform-ios iOS applications specifically team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team

Comments

@danReynolds
Copy link
danReynolds commented Feb 17, 2021

This issue has attracted significant attention, and the continuous stream of comments has been very distracting to to the team. Please read our guidelines on participating in issues before commenting on this issue.

Hello! Thanks for taking a time to look into the issue of jank with animations on iOS using the Metal shader API. It's an issue that a lot of folks have reported as per major threads here:

#32170
#74824
#74631

and I wanted to try and help by giving a clear example as per the guideline for this jank here:
#74833

System info

Device: iPhone 12 mini

Screen Shot 2021-02-16 at 11 50 22 PM

Source code

Demo lib is available here:
https://github.com/danReynolds/iosjank

It is a barebones flutter create app with a single dart file modified:
https://github.com/danReynolds/iosjank/blob/master/lib/main.dart

The animation it uses is from the OpenContainer component supplied by flutter here:
https://github.com/flutter/packages/blob/master/packages/animations/lib/src/open_container.dart

Video

A video of the jank is available here:
https://photos.google.com/share/AF1QipOIN6m7QjsVUf63zeMXriQW0pg_npG3e0mwBnzV_TojsNzN4kEpXzFiKC6vVRrUzg?key=Wk96RzBNdnFTRF8xTDVkV08yRGFlZHdxMktSUWRR

note how the animation of the floating button lags the first couple times on open/close.

Trace

A trace is available here: https://drive.google.com/file/d/1RhWnX_zytL_1KWjHtOxx0Ji_3Z-idRw3/view?usp=sharing

which was recorded as per the instructions here: https://medium.com/flutter/profiling-flutter-applications-using-the-timeline-a1a434964af3#a499

In Summary

I hope this example illustrates how the issue of iOS jank with Metal is pervasive in the most basic of apps with performant animations provided by the Flutter library itself. If there is anything more I can provide to help debug this issue I will do whatever it takes, so please let me know.

This is the biggest issue facing my organization's Flutter application and both our org and devs from other companies I've spoken to are considering moving away from Flutter if this problem is not resolved soon or given a timeline for being resolved in upcoming releases. I don't mean to be overly harsh, it's just a fact that we need robust performance on iOS in order for our application to succeed as a product.

Overall I've greatly enjoyed working with Flutter and would love to keep using and evangelizing it in the future. Thanks to everyone involved with this project. ❤️

@danReynolds danReynolds added the from: performance template Issues created via a performance issue template label Feb 17, 2021
@aliakhtar

This comment has been minimized.

@eseidelGoogle

This comment has been minimized.

@dodatw

This comment has been minimized.

@istornz

This comment has been minimized.

@pedromassangocode pedromassangocode added engine flutter/engine repository. See also e: labels. passed first triage perf: speed Performance issues related to (mostly rendering) speed platform-ios iOS applications specifically c: performance Relates to speed or footprint issues (see "perf:" labels) c: rendering UI glitches reported at the engine/skia rendering level customer: crowd Affects or could affect many people, though not necessarily a specific customer. and removed from: performance template Issues created via a performance issue template labels Feb 17, 2021
@masterlonghorn

This comment has been minimized.

@vukhacbiet

This comment has been minimized.

@JagandeepBrar

This comment has been minimized.

@theniceboy

This comment has been minimized.

@bennibau

This comment has been minimized.

@aliakhtar

This comment has been minimized.

@bennibau

This comment has been minimized.

@aliakhtar

This comment has been minimized.

@AphinityApp

This comment has been minimized.

@Hixie
Copy link
Contributor
Hixie commented Feb 17, 2021

Thank you @danReynolds for filing a fantastically precise and reproducible bug. Much appreciated. This will significantly help in addressing the issue.

@Hixie
Copy link
Contributor
Hixie commented Feb 17, 2021

Weird, the timeline doesn't seem to show the bad frames I see on the video. Investigating further...

@danReynolds
Copy link
Author

Weird, the timeline doesn't seem to show the bad frames I see on the video. Investigating further...

Yea I've never used the tracer before so let me know if I missed something. We can chat on Discord and I can always redo it tonight if something is amiss.

@Hixie
Copy link
Contributor
Hixie commented Feb 17, 2021

Trying this on the ancient Android tablet I have on my desk I do see the same jank there, FWIW. So this may not be iOS-specific.

@danReynolds
Copy link
Author
danReynolds commented Feb 17, 2021

Trying this on the ancient Android tablet I have on my desk I do see the same jank there, FWIW. So this may not be iOS-specific.

Ah interesting, yea my Pixel 3 runs slick but my new iPhone 12 is laggy on this and other animations so it's at least more of an issue on iOS. Let me know what the trace reveals

@nt4f04uNd

This comment has been minimized.

@Hixie
Copy link
Contributor
Hixie commented Sep 10, 2021

Looks like performance here is slightly better but still not good.

#77301 would help determine precisely which shaders are being triggered.
#77412 is probably the long-term solution here.

@Hixie Hixie removed their assignment Sep 16, 2021
@brunoalod
Copy link

Looks like performance here is slightly better but still not good.

#77301 would help determine precisely which shaders are being triggered. #77412 is probably the long-term solution here.

Hi Hixie, any update on this?

@Hixie
Copy link
Contributor
Hixie commented Dec 15, 2021

Work on 77412 continues and progress is looking good, but as noted in that issue, it's a long-term project (basically rewriting Skia) so it'll take a while. Nothing particular to report yet.

@bouraine
Copy link
bouraine commented May 1, 2022

Hi @Hixie have you made any progress you can share on this ?

@Hixie
Copy link
Contributor
Hixie commented May 2, 2022

Significant progress on 77412 continues to be made; the experimental branch just landed into the engine repo on Friday in fact. It'll still be many more months before this work is in a stable release though. It's basically a rewrite of our graphics backend, which is definitely a non-trivial effort.

@bennibau
Copy link
bennibau commented May 2, 2022

@Hixie Can you link the branch in the engine repo here? I would love to dig into it.

@dxvid-pts
Copy link

@Hixie Can you link the branch in the engine repo here? I would love to dig into it.

https://github.com/flutter/engine/tree/main/impeller

@brylie-wolt
Copy link

It was recently announced that Impeller is now included in Flutter 3.7 with initial support for iOS:

https://github.com/flutter/engine/tree/main/impeller#try-impeller-in-flutter

https://www.youtube.com/watch?v=gKrYWC_SDxQ

@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels Jul 8, 2023
@gaaclarke
Copy link
Member

@chinmaygarde I think we should consider closing this issue. The 90th percentile raster time should be an accurate measurement of jank since jank can be thought of as infrequent frames times > 1/fps. Here is the current state of the 90th percentile raster time for the benchmark that runs through the gallery app.

Screenshot 2023-09-18 at 10 25 04 AM

The grey line is impeller and the orange line is skia (link). Impeller has been turned on by default for iOS since 3.10.

This issue seems to be focused on iOS, so there is no need to gate it on any work for Android. I believe the jank issue manifested more on iOS.

If we decide not to close this now I think we should come up with good exit criteria for the issue, maybe file a separate issue for Android if we want.

@Hixie
Copy link
Contributor
Hixie commented Sep 22, 2023

Yeah this is definitely fixed!

If there are similar issues please don't hesitate to file new bugs and include as much detail as possible (including ideally code to reproduce the problem, precise steps for doing so, and maybe a video showing the problem, if that is possible).

@Hixie Hixie closed this as completed Sep 22, 2023
@github-actions
Copy link
github-actions bot commented Oct 6, 2023

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 flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: performance Relates to speed or footprint issues (see "perf:" labels) c: rendering UI glitches reported at the engine/skia rendering level customer: crowd Affects or could affect many people, though not necessarily a specific customer. engine flutter/engine repository. See also e: labels. P1 High-priority issues at the top of the work list perf: speed Performance issues related to (mostly rendering) speed platform-ios iOS applications specifically team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team
Projects
Early-onset jank
Specific reports (new)
Development

No branches or pull requests