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

[IOS]Image.toByteData() is super slow on Flutter 3 #106773

Closed
ssyzh opened this issue Jun 29, 2022 · 8 comments
Closed

[IOS]Image.toByteData() is super slow on Flutter 3 #106773

ssyzh opened this issue Jun 29, 2022 · 8 comments
Labels
a: images Loading, displaying, rendering images c: performance Relates to speed or footprint issues (see "perf:" labels) c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. found in release: 3.0 Found to occur in 3.0 found in release: 3.1 Found to occur in 3.1 has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-ios iOS applications specifically r: duplicate Issue is closed as a duplicate of an existing issue

Comments

@ssyzh
Copy link

ssyzh commented Jun 29, 2022

await image.toByteData(format: ImageByteFormat.png);

image.toByteData time consuming in flutter 2.10.5 and flutter 3.0.3, only in iOS

Steps to Reproduce

  1. Execute flutter run on the code sample
  2. in •flutter 2.10.5, • Dart version 2.16.2 • DevTools version 2.9.2 , total time is 1219ms
  3. in •flutter 3.0.3, • Dart version 2.17.5 • DevTools version 2.12.2 , total time is 8942ms

Expected results: The total time should be about the same

Actual results: 847ms and 8942ms, nearly eight times the difference! Even the real machine in release runs very very slow,eight times the difference!.

Code sample
void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final GlobalKey sharePageKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: RepaintBoundary(
          key: sharePageKey,
          child: Column(
            children: [
              Text(List.generate(200, (index) => "Text").join("#")),
              Image.network(
                "http://pic1.win4000.com/wallpaper/2020-10-10/5f811214aa09e.jpg",
                width: double.infinity,
              ),
            ],
          ),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          createImage();
        },
        child: const Text("create"),
      ),
    );
  }

  createImage() async {
    debugPrint("tim0 ${DateTime.now()}");
    DateTime start = DateTime.now();
    BuildContext? buildContext = sharePageKey.currentContext;
    if (null != buildContext) {
      RenderRepaintBoundary boundary =
          buildContext.findRenderObject() as RenderRepaintBoundary;
      ui.Image image = await boundary.toImage(pixelRatio: 5);
      debugPrint("tim1 ${DateTime.now()}");

      ByteData? byteData = await image.toByteData(format: ImageByteFormat.png);
      debugPrint("tim2  ${DateTime.now()}");

      if (byteData != null) {
        var pngBytes = byteData.buffer.asUint8List();
        debugPrint("tim3 ${DateTime.now()}");
        debugPrint(
            "total ${DateTime.now().millisecondsSinceEpoch - start.millisecondsSinceEpoch}");
      }
    }
  }
}
Logs

flutter: tim0 2022-06-29 10:58:55.542207
flutter: tim1 2022-06-29 10:58:55.621826
flutter: tim2  2022-06-29 10:58:56.764545
flutter: tim3 2022-06-29 10:58:56.764890
flutter: total 1219


[✓] Flutter (Channel unknown, 2.10.5, on macOS 12.3.1 21E258 darwin-x64, locale zh-Hans-CN)
    • Flutter version 2.10.5 at /Users/sunhao/Documents/developer/flutter
    • Upstream repository unknown
    • Framework revision 5464c5bac7 (2 months ago), 2022-04-18 09:55:37 -0700
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2
    • Pub download mirror https://mirrors.tuna.tsinghua.edu.cn/dart-pub
    • Flutter download mirror https://mirrors.tuna.tsinghua.edu.cn/flutter

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/sunhao/Documents/developer/Android/sdk
    • Platform android-32, build-tools 32.0.0
    • ANDROID_HOME = /Users/sunhao/Documents/developer/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.68.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • iPhone 12 (mobile) • 9A3514D1-1F7A-4114-BEFF-9609739BE58C • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 103.0.5060.53
    ! Error: ssyzh-iPhone is not connected. Xcode will continue when ssyzh-iPhone is connected. (code -13)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
flutter: tim0 2022-06-29 10:37:19.759706
flutter: tim1 2022-06-29 10:37:19.865037
flutter: tim2  2022-06-29 10:37:28.702424
flutter: tim3 2022-06-29 10:37:28.703828
flutter: total 8942


[✓] Flutter (Channel stable, 3.0.3, on macOS 12.3.1 21E258 darwin-x64, locale zh-Hans-CN)
    • Flutter version 3.0.3 at /Users/sunhao/Documents/developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 676cefaaff (6 days ago), 2022-06-22 11:34:49 -0700
    • Engine revision ffe7b86a1e
    • Dart version 2.17.5
    • DevTools version 2.12.2
    • Pub download mirror https://mirrors.tuna.tsinghua.edu.cn/dart-pub
    • Flutter download mirror https://mirrors.tuna.tsinghua.edu.cn/flutter

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/sunhao/Documents/developer/Android/sdk
    • Platform android-32, build-tools 32.0.0
    • ANDROID_HOME = /Users/sunhao/Documents/developer/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.68.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available)
    • ssyzh-iPhone (mobile) • 00008020-000371162EC1002E            • ios            • iOS 15.2.1 19C63
    • iPhone 12 (mobile)    • 9A3514D1-1F7A-4114-BEFF-9609739BE58C • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)
    • macOS (desktop)       • macos                                • darwin-x64     • macOS 12.3.1 21E258 darwin-x64
    • Chrome (web)          • chrome                               • web-javascript • Google Chrome 103.0.5060.53

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
Process finished with exit code 0


@ssyzh
Copy link
Author

ssyzh commented Jun 29, 2022

#104300 same issues, because it was closed,so I had to create a new one.

@ssyzh ssyzh changed the title Image.toByteData() becames super SLOW after Flutter 3 Image.toByteData() become super SLOW after Flutter 3 ,only in iOS Jun 29, 2022
@maheshmnj maheshmnj added the in triage Presently being triaged by the triage team label Jun 29, 2022
@maheshmnj
Copy link
Member

maheshmnj commented Jun 29, 2022

Hi @ssyzh, Thanks for filing the issue. I am able to reproduce the issue. Compared to stable 2.10.5 I am seeing 3x delay on the latest stable and the master channel on IOS. While the results are nearly the same on Android

code sample
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final GlobalKey sharePageKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: RepaintBoundary(
          key: sharePageKey,
          child: Column(
            children: [
              Text(List.generate(200, (index) => "Text").join("#")),
              Image.network(
                "http://pic1.win4000.com/wallpaper/2020-10-10/5f811214aa09e.jpg",
                width: double.infinity,
              ),
            ],
          ),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          createImage();
        },
        child: const Text("create"),
      ),
    );
  }

  createImage() async {
    final stopWatch = Stopwatch();
    stopWatch.start();
    debugPrint("tim0 ${DateTime.now()}");
    BuildContext? buildContext = sharePageKey.currentContext;
    if (null != buildContext) {
      RenderRepaintBoundary boundary =
          buildContext.findRenderObject() as RenderRepaintBoundary;
      ui.Image image = await boundary.toImage(pixelRatio: 5);
      ByteData? byteData =
          await image.toByteData(format: ui.ImageByteFormat.png);
      if (byteData != null) {
        var pngBytes = byteData.buffer.asUint8List();
        debugPrint("time elapsed in (ms) = ${stopWatch.elapsedMilliseconds}");
      }
      stopWatch.stop();
    }
  }
}
logs(Android stable 3.0.3) Roughly 1.5 secs
mahesh@Maheshs-MacBook-Air-M1 sample % flutter run
Multiple devices found:
Redmi K20 Pro (mobile) • 192.168.1.2:5555                     • android-arm64  • Android 11 (API 30)
iPhone 13 (mobile)     • 45B9B8CF-D1FB-4D13-9133-9923FA5C7489 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2
(simulator)
macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.4 21F79 darwin-arm
Chrome (web)           • chrome                               • web-javascript • Google Chrome 103.0.5060.53
[1]: Redmi K20 Pro (192.168.1.2:5555)
[2]: iPhone 13 (45B9B8CF-D1FB-4D13-9133-9923FA5C7489)
[3]: macOS (macos)
[4]: Chrome (chrome)
Please choose one (To quit, press "q/Q"): 1
Launching lib/main.dart on Redmi K20 Pro in debug mode...
Running Gradle task 'assembleDebug'...                             15.5s
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...               148.4s
Syncing files to device Redmi K20 Pro...                            77ms
I/.example.sampl(17354): ProcessProfilingInfo new_methods=944 is saved saved_to_disk=1 resolve_classes_delay=8000

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

An Observatory debugger and profiler on Redmi K20 Pro is available at: http://127.0.0.1:51549/yfpbYPFX0Ho=/
The Flutter DevTools debugger and profiler on Redmi K20 Pro is available at:
http://127.0.0.1:9100?uri=http://127.0.0.1:51549/yfpbYPFX0Ho=/
W/BpBinder(17354): PerfMonitor binderTransact :  time=233ms interface=android.app.IActivityTaskManager code=67
D/SurfaceView(17354): UPDATE null, mIsCastMode = false
D/MIUIInput(17354): [MotionEvent] ViewRootImpl { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=135866836, downTime=135866836 } moveCount:0
W/MirrorManager(17354): this model don't Support
D/MIUIInput(17354): [MotionEvent] ViewRootImpl { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=135866968, downTime=135866836 } moveCount:0
I/flutter (17354): tim0 2022-06-29 13:15:19.005824
I/flutter (17354): time elapsed in (ms) = 1594
logs(ios flutter 3.0.3 stable/ 3.1.0 master) takes around 3-3.2 secs
mahesh@Maheshs-MacBook-Air-M1 sample % flutterm run
Could not load custom device from config index 0: Expected enabled to be a boolean.
Error 1 retrieving device properties for Redmi K20 Pro:
error: closed


Multiple devices found:
Redmi K20 Pro (mobile)    • 192.168.1.2:5555                     • android-arm    • Android null (API null)
sdk gphone arm64 (mobile) • emulator-5554                        • android-arm64  • Android 11 (API 30) (emulator)
iPhone 13 (mobile)        • 45B9B8CF-D1FB-4D13-9133-9923FA5C7489 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
macOS (desktop)           • macos                                • darwin-arm64   • macOS 12.4 21F79 darwin-arm
Chrome (web)              • chrome                               • web-javascript • Google Chrome 103.0.5060.53
[1]: Redmi K20 Pro (192.168.1.2:5555)
[2]: sdk gphone arm64 (emulator-5554)
[3]: iPhone 13 (45B9B8CF-D1FB-4D13-9133-9923FA5C7489)
[4]: macOS (macos)
[5]: Chrome (chrome)
Please choose one (To quit, press "q/Q"): 3
Running "flutter pub get" in sample...                           2,517ms
Launching lib/main.dart on iPhone 13 in debug mode...
Running Xcode build...                                                  
 └─Compiling, linking and signing...                         3.1s
Xcode build done.                                           19.4s
Syncing files to device iPhone 13...                               132ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

An Observatory debugger and profiler on iPhone 13 is available at: http://127.0.0.1:52552/_3undqG4JXk=/
The Flutter DevTools debugger and profiler on iPhone 13 is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:52552/_3undqG4JXk=/
flutter: tim0 2022-06-29 13:34:37.533987
flutter: time elapsed in (ms) = 3286
flutter: tim0 2022-06-29 13:34:45.714613
flutter: time elapsed in (ms) = 3600
flutter: tim0 2022-06-29 13:34:50.914327
flutter: time elapsed in (ms) = 3117
logs (ios) stable 2.10.5 takes 700-800ms
mahesh@Maheshs-MacBook-Air-M1 sample % flutterd run
Could not load custom device from config index 0: Expected enabled to
be a boolean.
Multiple devices found:
Redmi K20 Pro (mobile) • 192.168.1.2:5555                     •
android-arm64  • Android 11 (API 30)
iPhone 13 (mobile)     • 45B9B8CF-D1FB-4D13-9133-9923FA5C7489 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
macOS (desktop)        • macos                                •
darwin-arm64   • macOS 12.4 21F79 darwin-arm
Chrome (web)           • chrome                               •
web-javascript • Google Chrome 103.0.5060.53
[1]: Redmi K20 Pro (192.168.1.2:5555)
[2]: iPhone 13 (45B9B8CF-D1FB-4D13-9133-9923FA5C7489)
[3]: macOS (macos)
[4]: Chrome (chrome)
Please choose one (To quit, press "q/Q"): 2
Running "flutter pub get" in sample...                                2,236ms
Launching lib/main.dart on iPhone 13 in debug mode...
Running Xcode build...                                                  
 └─Compiling, linking and signing...                         3.0s
Xcode build done.                                           19.9s
Syncing files to device iPhone 13...                                    192ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

An Observatory debugger and profiler on iPhone 13 is available at:
http://127.0.0.1:51781/W6BltWQmmB4=/
The Flutter DevTools debugger and profiler on iPhone 13 is available
at: http://127.0.0.1:9100?uri=http://127.0.0.1:51781/W6BltWQmmB4=/
flutter: tim0 2022-06-29 13:20:04.162004
flutter: time elapsed in (ms) = 809
flutter: tim0 2022-06-29 13:20:06.926483
flutter: time elapsed in (ms) = 802
flutter: tim0 2022-06-29 13:20:09.125137
flutter: time elapsed in (ms) = 776
flutter doctor -v (mac)
[✓] Flutter (Channel stable, 3.0.3, on macOS 12.4 21F79 darwin-arm, locale en-IN)
    • Flutter version 3.0.3 at /Users/mahesh/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 676cefaaff (5 days ago), 2022-06-22 11:34:49 -0700
    • Engine revision ffe7b86a1e
    • Dart version 2.17.5
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4)
    • Android SDK at /Users/mahesh/Library/Android/sdk
    • Platform android-32, build-tools 33.0.0-rc4
    • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2021.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 61.2.4
    • Dart plugin version 212.5080.8

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

[✓] Connected device (3 available)
    • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64  • Android 11 (API 30) (emulator)
    • macOS (desktop)           • macos         • darwin-arm64   • macOS 12.4 21F79 darwin-arm
    • Chrome (web)              • chrome        • web-javascript • Google Chrome 103.0.5060.53

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
[✓] Flutter (Channel master, 3.1.0-0.0.pre.1376, on macOS 12.4 21F79 darwin-arm, locale en-IN)
    • Flutter version 3.1.0-0.0.pre.1376 on channel master at /Users/mahesh/Documents/flutter_master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3598f20002 (9 hours ago), 2022-06-26 18:19:04 -0400
    • Engine revision ee56813c14
    • Dart version 2.18.0 (build 2.18.0-228.0.dev)
    • DevTools version 2.14.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4)
    • Android SDK at /Users/mahesh/Library/Android/sdk
    • Platform android-32, build-tools 33.0.0-rc4
    • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13C100
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2021.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 61.2.4
    • Dart plugin version 212.5080.8

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

[✓] Connected device (3 available)
    • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64  • Android 11 (API 30) (emulator)
    • macOS (desktop)           • macos         • darwin-arm64   • macOS 12.4 21F79 darwin-arm
    • Chrome (web)              • chrome        • web-javascript • Google Chrome 103.0.5060.53

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

@maheshmnj maheshmnj added c: regression It was better in the past than it is now platform-ios iOS applications specifically c: performance Relates to speed or footprint issues (see "perf:" labels) a: images Loading, displaying, rendering images engine flutter/engine repository. See also e: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 3.0 Found to occur in 3.0 found in release: 3.1 Found to occur in 3.1 and removed in triage Presently being triaged by the triage team labels Jun 29, 2022
@maheshmnj maheshmnj changed the title Image.toByteData() become super SLOW after Flutter 3 ,only in iOS [IOS]Image.toByteData() is super slow on Flutter 3 Jun 29, 2022
@jason-simmons
Copy link
Member

This started with a change to the engine's thread priorities (flutter/engine@5140a44)

The image encoding work is done on the IO thread, which is configured with a reduced priority.

Is anyone seeing significant issues on a real device? Or is this only affecting iOS simulators?

@ssyzh
Copy link
Author

ssyzh commented Jun 30, 2022

This started with a change to the engine's thread priorities (flutter/engine@5140a44)

The image encoding work is done on the IO thread, which is configured with a reduced priority.

Is anyone seeing significant issues on a real device? Or is this only affecting iOS simulators?

iPhone XR , iPhone x, and iPhone 13, These are my real devices,and test in release mode.

@ssyzh
Copy link
Author

ssyzh commented Jun 30, 2022

This started with a change to the engine's thread priorities (flutter/engine@5140a44)
The image encoding work is done on the IO thread, which is configured with a reduced priority.
Is anyone seeing significant issues on a real device? Or is this only affecting iOS simulators?

iPhone XR , iPhone x, and iPhone 13, These are my real devices,and test in release mode.

In addition, it seems that the release mode is slower than the debug mode, and in the debug mode, it is not necessarily slow every time, but most of the time.

@ninoid
Copy link

ninoid commented Jul 8, 2022

Very slow for iOS devices in release mode :(

@chinmaygarde
Copy link
Member

This is a duplicate of #107351 which is under discussion. Fixing that will resolve this as well.

@maheshmnj maheshmnj added the r: duplicate Issue is closed as a duplicate of an existing issue label Jul 12, 2022
@github-actions
Copy link

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 Jul 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: images Loading, displaying, rendering images c: performance Relates to speed or footprint issues (see "perf:" labels) c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. found in release: 3.0 Found to occur in 3.0 found in release: 3.1 Found to occur in 3.1 has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-ios iOS applications specifically r: duplicate Issue is closed as a duplicate of an existing issue
Projects
None yet
Development

No branches or pull requests

5 participants