Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Regression in performance from Flutter 1.23.0-13.0.pre and above on older iOS devices #78507

@guibarrette

Description

@guibarrette

Details

I'm very happy to see the desktop support now accessible from the stable release of Flutter! So I upgraded my application to the stable release. However, I'm getting a performance regression on older iOS devices, by that I mean that the application freeze by a CPU overload during animation (sometimes during popup animation or during a page navigation) and while playing videos.

At the beginning I was thinking this could be related to the jank problem everyone is talking about. However, the devices that I'm having problems with are older iOS devices (iPad 2 and iPad 4) which should use the OpenGL renderer instead of the Metal renderer.

By further investigation, I found that the problem started from Flutter 1.23.0-13.0.pre and above since everything is fine on Flutter 1.23.0-7.0.pre and below; by that I mean there's still some jank, but the application doesn't freeze and is a lot more responsible and usable.

If this is useful to help solve this problem, the commit messages of Flutter between 2020-10-01 and 2020-10-12, which is the timeframe between Flutter 1.23.0-7.0.pre and 1.23.0-13.0.pre, can be found here: https://github.com/flutter/flutter/commits/dev?since=2020-10-01&until=2020-10-12

I've tested with Flutter Stable 2.0.2 and the Master version and both have the problem and seems to be related to the drawing to the surface which takes a very long time.

I've tested by creating 2 small applications:

  1. The default application created by Flutter (the simple counter create with flutter create)
  2. A simple video player based on the video_player plugin. Gist: https://gist.github.com/guibarrette/2cf49c010be2ae231b259d8de7bf2e19

The first application feel more janky on newer Flutter version than 1.23.0-7.0.pre, but the later simply doesn't let the video play; it simply freeze, but is working fine on 1.23.0-7.0.pre.

Here are 4 videos showing the different performance of those Flutter versions with the second test application:

The 3 source codes used for those videos can be found at this repository: Repository Link

I've tested with video_player 1.0.1 to make it compatible with Flutter 1.23.0-7.0.pre and 2.0.2, but upgraded to video_player 2.0.2 for the Flutter Master version. Sorry, I did the videos with the performance overlay since I didn't see at that time that it was preferable without and it helped myself to see the performance freeze, but you can see on the video of the Master version that the freeze is there on a --release version and without the performance overlay.

1.23.0-7.0.pre (Working fine):

Using video_player 1.0.1
Observatory timeline trace: dart-timeline-2021-3-17-Flutter-1_23-Video.zip
Video: https://share.getcloudapp.com/Qwu9OQOJ

Stable 2.0.2 (Freeze):

Using video_player 1.0.1
Observatory timeline trace: dart-timeline-2021-3-17-Flutter-2_0_2-Video.zip
Video: https://share.getcloudapp.com/Qwu9OGx0

Stable 2.0.2 (same build, but longer video) (Freeze):

Using video_player 1.0.1
Observatory timeline trace: dart-timeline-2021-3-17-Flutter-2_0_2-Video-2.zip
Video: https://share.getcloudapp.com/Z4u6WwxP

Master (2021-03-17) (Freeze):

Using video_player 2.0.2
Video: https://share.getcloudapp.com/E0u9wElr

With the latest Master version I'm not able to flutter run --profile --trace-skia on my iOS device since I'm using macOS Mojave (10.14.6) with Xcode 11.3.1, but I changed the minimum Xcode version of Flutter so it let me compile and I uploaded manually with ios-deploy. So for this video I've built with flutter build ios --release. Therefore, I'm simply attaching the video here without the observatory timeline to show that it freezes the same as with Flutter 2.0.2 and even when the performance overlay is not active.

Target Platform:

  • iOS

Target OS version/browser:

Tested and problematic on:

  • iOS 9.3.5
  • iOS 10.3.3

Devices:

  • iPad 2 (Model: MC769LL/A) (iOS 9.3.5)
  • iPad 4 (Model: MD513C/A) (iOS 10.3.3)

Logs

Logs
Running "flutter pub get" in flutter_ios_video_freeze_master...      1 652ms
Analyzing flutter_ios_video_freeze_master...
No issues found! (ran in 4.8s)

Flutter Doctor:

1.23.0-7.0.pre:

[✓] Flutter (Channel dev, 1.23.0-7.0.pre, on Mac OS X 10.14.6 18G6032 x86_64, locale fr-CA)
    • Flutter version 1.23.0-7.0.pre at /Users/GuillaumeBarrette/Documents/Programmation/Flutter/flutter
    • Framework revision db6e2d8aa5 (il y a 6 mois), 2020-09-25 06:47:03 -0400
    • Engine revision 3a73d073c8
    • Dart version 2.11.0 (build 2.11.0-161.0.dev)


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/GuillaumeBarrette/Library/Android/sdk
    • Platform android-29, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C505
    • CocoaPods version 1.10.1

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 43.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.54.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (2 available)
    • IPad PSM-11 (mobile) • bdfb2550f9cb07f766bde4185e0ae060c833cb23 • ios        • iOS 10.3.3
    • macOS (desktop)      • macos                                    • darwin-x64 • Mac OS X 10.14.6 18G6032 x86_64

• No issues found!

Stable 2.0.2:

[✓] Flutter (Channel stable, 2.0.2, on Mac OS X 10.14.6 18G6032 darwin-x64, locale fr-CA)
    • Flutter version 2.0.2 at /Users/GuillaumeBarrette/Documents/Programmation/Flutter/flutter
    • Framework revision 8962f6dc68 (il y a 6 jours), 2021-03-11 13:22:20 -0800
    • Engine revision 5d8bf811b3
    • Dart version 2.12.1

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/GuillaumeBarrette/Library/Android/sdk
    • Platform android-29, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C505
    ! Xcode 11.3.1 out of date (12.0.1 is recommended).
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 43.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.54.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (3 available)
    • IPad PSM-11 (mobile) • bdfb2550f9cb07f766bde4185e0ae060c833cb23 • ios            • iOS 10.3.3
    • macOS (desktop)      • macos                                    • darwin-x64     • Mac OS X 10.14.6 18G6032 darwin-x64
    • Chrome (web)         • chrome                                   • web-javascript • Google Chrome 89.0.4389.90

! Doctor found issues in 1 category.

Master (2021-03-17):

[✓] Flutter (Channel master, 2.1.0-13.0.pre.149, on Mac OS X 10.14.6 18G6032 darwin-x64, locale fr-CA)
    • Flutter version 2.1.0-13.0.pre.149 at /Users/GuillaumeBarrette/Documents/Programmation/Flutter/flutter
    • Framework revision 637fb5b9be (il y a 38 minutes), 2021-03-17 18:25:04 -0400
    • Engine revision c0e6763e6b
    • Dart version 2.13.0 (build 2.13.0-147.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/GuillaumeBarrette/Library/Android/sdk
    • Platform android-29, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C505
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 43.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.54.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (3 available)
    • IPad PSM-11 (mobile) • bdfb2550f9cb07f766bde4185e0ae060c833cb23 • ios            • iOS 10.3.3
    • macOS (desktop)      • macos                                    • darwin-x64     • Mac OS X 10.14.6 18G6032 darwin-x64
    • Chrome (web)         • chrome                                   • web-javascript • Google Chrome 89.0.4389.90

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)c: regressionIt was better in the past than it is nowc: renderingUI glitches reported at the engine/skia or impeller rendering levelengineflutter/engine related. See also e: labels.perf: speedPerformance issues related to (mostly rendering) speedplatform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions