Since Flutter 1.12 (when Flutter switched to Metal rendering from OpenGL), first runs of an application appear to jank (skip frames more often).
The Flutter team is working on this, but in the mean time what can I do?
Since Flutter 1.12 (when Flutter switched to Metal rendering from OpenGL), first runs of an application appear to jank (skip frames more often).
The Flutter team is working on this, but in the mean time what can I do?
Before anything: make sure the jank you are seeing is truly related to this issue. If your application was already janky on the OpenGL backend in iOS, or is janky on Android (where shader caching is implemented), you likely have some other performance related problem. Try working through performance profiling in Flutter - i.e. record some timelines and analyze what's going on in frame workloads.
EDIT 2/23/2021
Metal binary archive work turned out to be a dead end. See https://github.com/flutter/engine/pull/23914 for more details. This is still a high priority item for the Flutter team, but the timeline for a fix is unknown right now.
end edit
Otherwise:
A little background:
Shaders are small programs that Skia creates from various drawing commands to create a program that the GPU can execute to actually draw pixels on the screen. Compiling them can take non-trivial amounts of time, and different scenes may require different shader programs. Flutter's architecture is designed to cache and reuse compiled shader programs so that they can be reused once they are compiled. Support for this exists in the OpenGL based backend in Skia, but is still being worked on for the Metal based backend (see https://skbug.com/10804).
There were a lot of good reasons to migrate to Metal.
We did briefly consider supporting both OpenGL and Metal, but decided not to. There are limited resources to address bugs in that layer of the stack, we were already aware of a number of perofrmance related issues that Metal solved.
© 2022 - 2024 — McMap. All rights reserved.