Skip to content

Linux Desktop: high CPU usage when running an animation #101591

Open

Description

@fusion44

Hi!

CPU usage goes through the roof when I run a simple animation on Linux Desktop. Please find the minimum sample app below. I ran the same code on a Windows machine where this problem does not occur. I've don't have access to a Mac to test it there.

When running the app with the profiler enabled I've noticed that the FPS is at 60 FPS all the time but visually the animation is quite janky. It only gets better marginally when run in release mode. This might be a clue that the problem occurs when presenting the frame to the screen?

I've verified that the graphics drivers work well on my Linux system by running a the same game on Linux and Windows. They ran at nearly the same FPS.

I've tried both, the stable and master channels with the same results.

All tests are ran on the same machine which is dual booted between Linux / Windows

edit: added more hardware / software info

CPU usage on Linux:

  • Linux with animation: all 8 cores are used between 30-50 %.
    Bildschirmfoto von 2022-04-08 18-32-12

  • Linux, no animation: all 8 cores are used at around 5 %, matching Windows
    Bildschirmfoto von 2022-04-08 18-38-26

  • Linux, with animimation, Vivaldi browser smooth animation, normal CPU usage
    Bildschirmfoto von 2022-04-08 19-09-12

  • Windows, with animation: all 8 cores are used at around 5-10 %
    image

Details

Code to reproduce. This is a standard flutter create project with the counter text replaced with a CircularProgressIndicator()

import 'package:flutter/material.dart';

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

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

  // This widget is the root of your application.
  @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> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: const Center(
        child: CircularProgressIndicator(),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Target Platform: Linux Desktop
Target OS version/browser: Ubuntu 21.10 (Regolith Linux flavor)
Devices: amd64 platform

image

Logs

Logs
fusion44@fusion44-UM700:~/dev/stuff/bug$ flutter run --profile -v
[  +73 ms] executing: uname -m
[  +37 ms] Exit code 0 from: uname -m
[        ] x86_64
[   +6 ms] executing: [/home/fusion44/snap/flutter/common/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +7 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] c860cba910319332564e1e9d470a17074c1f2dfd
[        ] executing: [/home/fusion44/snap/flutter/common/flutter/] git tag --points-at c860cba910319332564e1e9d470a17074c1f2dfd
[  +17 ms] Exit code 0 from: git tag --points-at c860cba910319332564e1e9d470a17074c1f2dfd
[        ] 2.10.4
[  +13 ms] executing: [/home/fusion44/snap/flutter/common/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[   +7 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/home/fusion44/snap/flutter/common/flutter/] git ls-remote --get-url origin
[   +7 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +88 ms] executing: [/home/fusion44/snap/flutter/common/flutter/] git rev-parse --abbrev-ref HEAD
[   +6 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +59 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +60 ms] executing: /home/fusion44/Android/Sdk/platform-tools/adb devices -l
[  +59 ms] List of devices attached
[   +7 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +131 ms] Skipping pub get: version match.
[  +79 ms] Generating /home/fusion44/dev/stuff/bug/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[  +97 ms] Launching lib/main.dart on Linux in profile mode...
[  +17 ms] Building Linux application...
[   +8 ms] executing: [build/linux/x64/profile/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Profile -DFLUTTER_TARGET_PLATFORM=linux-x64 /home/fusion44/dev/stuff/bug/linux
[  +42 ms] -- Configuring done
[   +4 ms] -- Generating done
[        ] -- Build files have been written to: /home/fusion44/dev/stuff/bug/build/linux/x64/profile
[   +5 ms] executing: ninja -C build/linux/x64/profile install
[   +8 ms] ninja: Entering directory `build/linux/x64/profile'
[+1944 ms] [1/5] Generating /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/libflutter_linux_gtk.so, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h,
/home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_engine.h,
/home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h,
/home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_method_call.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h,
/home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_method_response.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h,
/home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h,
/home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_value.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/fl_view.h, /home/fusion44/dev/stuff/bug/linux/flutter/ephemeral/flutter_linux/flutter_linux.h, _phony_
[   +6 ms] [  +65 ms] executing: uname -m
[        ] [  +34 ms] Exit code 0 from: uname -m
[        ] [        ] x86_64
[        ] [   +5 ms] executing: [/home/fusion44/snap/flutter/common/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [   +6 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [        ] c860cba910319332564e1e9d470a17074c1f2dfd
[        ] [        ] executing: [/home/fusion44/snap/flutter/common/flutter/] git tag --points-at c860cba910319332564e1e9d470a17074c1f2dfd
[        ] [  +23 ms] Exit code 0 from: git tag --points-at c860cba910319332564e1e9d470a17074c1f2dfd
[        ] [        ] 2.10.4
[        ] [   +9 ms] executing: [/home/fusion44/snap/flutter/common/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[        ] [   +6 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] [        ] origin/stable
[        ] [        ] executing: [/home/fusion44/snap/flutter/common/flutter/] git ls-remote --get-url origin
[        ] [   +5 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] [        ] https://github.com/flutter/flutter.git
[        ] [  +54 ms] executing: [/home/fusion44/snap/flutter/common/flutter/] git rev-parse --abbrev-ref HEAD
[        ] [   +4 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] [        ] stable
[        ] [  +49 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [  +90 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [   +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[        ] [  +79 ms] Initializing file store
[        ] [   +8 ms] Done initializing file store
[        ] [  +42 ms] Skipping target: gen_localizations
[        ] [  +10 ms] Skipping target: gen_dart_plugin_registrant
[        ] [ +256 ms] Skipping target: unpack_linux
[        ] [ +306 ms] Skipping target: kernel_snapshot
[        ] [  +30 ms] Skipping target: aot_elf_profile
[        ] [  +28 ms] Skipping target: linux_aot_bundle
[        ] [  +28 ms] Skipping target: profile_bundle_linux-x64_assets
[        ] [        ] Persisting file store
[        ] [   +8 ms] Done persisting file store
[        ] [   +4 ms] build succeeded.
[        ] [   +7 ms] "flutter assemble" took 929ms.
[        ] [   +3 ms] Running shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [   +3 ms] exiting with code 0
[ +418 ms] [2/5] Building CXX object CMakeFiles/bug.dir/flutter/generated_plugin_registrant.cc.o
[  +61 ms] [3/5] Building CXX object CMakeFiles/bug.dir/my_application.cc.o
[ +168 ms] [4/5] Linking CXX executable intermediates_do_not_run/bug
[        ] /snap/flutter/current/usr/bin/ld: warning: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crt1.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0008002
[   +1 ms] [4/5] Install the project...
[  +12 ms] -- Install configuration: "Profile"
[   +4 ms] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/bug
[        ] -- Set runtime path of "/home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/bug" to "$ORIGIN/lib"
[        ] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/data/icudtl.dat
[        ] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/lib/libflutter_linux_gtk.so
[  +18 ms] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/data/flutter_assets
[        ] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/data/flutter_assets/version.json
[        ] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/data/flutter_assets/packages
[        ] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/data/flutter_assets/packages/cupertino_icons
[        ] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/data/flutter_assets/packages/cupertino_icons/assets
[        ] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/data/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf
[        ] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/data/flutter_assets/FontManifest.json
[        ] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/data/flutter_assets/NOTICES.Z
[        ] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/data/flutter_assets/fonts
[        ] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/data/flutter_assets/fonts/MaterialIcons-Regular.otf
[   +1 ms] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/data/flutter_assets/AssetManifest.json
[        ] -- Installing: /home/fusion44/dev/stuff/bug/build/linux/x64/profile/bundle/lib/libapp.so
[  +20 ms] Building Linux application... (completed in 2.725ms)
[ +152 ms] Observatory URL on device: http://127.0.0.1:34923/ZLyJK_2OVGY=/
[  +15 ms] Connecting to service protocol: http://127.0.0.1:34923/ZLyJK_2OVGY=/
[ +138 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:34923/ZLyJK_2OVGY=/.
[ +107 ms] DDS is listening at http://127.0.0.1:42571/wEavpuc77xs=/.
[  +66 ms] Successfully connected to service protocol: http://127.0.0.1:34923/ZLyJK_2OVGY=/
[   +9 ms] Application running.
[  +32 ms] Connected to Linux
[   +2 ms] Flutter run key commands.
[   +2 ms] h List all available interactive commands.
[   +2 ms] c Clear the screen
[        ] q Quit (terminate the application on the device).
[   +3 ms] An Observatory debugger and profiler on Linux is available at: http://127.0.0.1:42571/wEavpuc77xs=/
[ +167 ms] The Flutter DevTools debugger and profiler on Linux is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:42571/wEavpuc77xs=/

fusion44@fusion44-UM700:~/dev/stuff/bug$ flutter doctor -v
[✓] Flutter (Channel stable, 2.10.4, on Ubuntu 21.10 5.13.0-39-generic, locale de_DE.UTF-8)
    • Flutter version 2.10.4 at /home/fusion44/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c860cba910 (vor 2 Wochen), 2022-03-25 00:23:12 -0500
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /home/fusion44/Android/Sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[✓] Android Studio (version 2021.1)
    • Android Studio at /snap/android-studio/119/android-studio
    • 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.11+0-b60-7590822)

[✓] VS Code
    • VS Code at /snap/code/current
    • Flutter extension version 3.38.1

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 21.10 5.13.0-39-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 100.0.4896.75

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

! Doctor found issues in 1 category.

Activity

  1. maheshj01 commented on Apr 11, 2022

    @maheshj01
    Member

    Hi @fusion44, thanks for filing the issue. I am able to reproduce the issue on stable and the master channel. The CPU usage with just circular progress indicator animating is pretty high. On avergae I saw the usage was at 35% and sometimes as high as 45%.

    The below screenshot shows the flutter app (Linux_test) using 36% CPU usage

    image

    Here's the timeline trace from the master channel in debug mode, if this can help figure out the issue.

    flutter doctor -v (Linux)
    [✓] Flutter (Channel stable, 2.10.4, on Ubuntu 20.04.4 LTS 5.13.0-30-generic, locale en_GB.UTF-8)
        • Flutter version 2.10.4 at /home/mahesh/Development/stable
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision c860cba910 (12 days ago), 2022-03-25 00:23:12 -0500
        • Engine revision 57d3bac3dd
        • Dart version 2.16.2
        • DevTools version 2.9.2
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /home/mahesh/Android/Sdk
        • Platform android-31, build-tools 31.0.0
        • Java binary at: /home/mahesh/Downloads/android-studio-2020.3.1.25-linux/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web
        • Chrome at google-chrome
    
    [✓] Linux toolchain - develop for Linux desktop
        • clang version 10.0.0-4ubuntu1
        • cmake version 3.16.3
        • ninja version 1.10.0
        • pkg-config version 0.29.1
    
    [✓] Android Studio (version 2020.3)
        • Android Studio at /home/mahesh/Downloads/android-studio-2020.3.1.25-linux/android-studio
        • Flutter plugin version 63.2.1
        • Dart plugin version 203.8452
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    
    [✓] VS Code (version 1.64.2)
        • VS Code at /usr/share/code
        • Flutter extension version 3.38.1
    
    [✓] Connected device (2 available)
        • Linux (desktop) • linux  • linux-x64      • Ubuntu 20.04.4 LTS 5.13.0-30-generic
        • Chrome (web)    • chrome • web-javascript • Google Chrome 98.0.4758.102
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
    [✓] Flutter (Channel master, 2.13.0-0.0.pre.392, on Ubuntu 20.04.4 LTS 5.13.0-30-generic, locale en_GB.UTF-8)
        • Flutter version 2.13.0-0.0.pre.392 at /home/mahesh/Development/master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 120b3deb18 (20 minutes ago), 2022-04-06 10:59:37 +0200
        • Engine revision 45bedbe841
        • Dart version 2.17.0 (build 2.17.0-266.0.dev)
        • DevTools version 2.12.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /home/mahesh/Android/Sdk
        • Platform android-31, build-tools 31.0.0
        • Java binary at: /home/mahesh/Downloads/android-studio-2020.3.1.25-linux/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web
        • Chrome at google-chrome
    
    [✓] Linux toolchain - develop for Linux desktop
        • clang version 10.0.0-4ubuntu1
        • cmake version 3.16.3
        • ninja version 1.10.0
        • pkg-config version 0.29.1
    
    [✓] Android Studio (version 2020.3)
        • Android Studio at /home/mahesh/Downloads/android-studio-2020.3.1.25-linux/android-studio
        • Flutter plugin version 63.2.1
        • Dart plugin version 203.8452
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    
    [✓] VS Code (version 1.64.2)
        • VS Code at /usr/share/code
        • Flutter extension version 3.38.1
    
    [✓] Connected device (2 available)
        • Linux (desktop) • linux  • linux-x64      • Ubuntu 20.04.4 LTS 5.13.0-30-generic
        • Chrome (web)    • chrome • web-javascript • Google Chrome 98.0.4758.102
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    
  2. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: performanceRelates to speed or footprint issues (see "perf:" labels)
    platform-linuxBuilding on or for Linux specifically
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    engineflutter/engine related. See also e: labels.
    and removed
    in triagePresently being triaged by the triage team
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Apr 11, 2022
  3. 13 remaining items

  4. added
    team-linuxOwned by the Linux platform team
    and removed on Jun 6, 2024
  5. flutter-triage-bot commented on Jun 6, 2024

    @flutter-triage-bot

    The triaged-desktop label is irrelevant if there is no team-desktop label or fyi-desktop label.

  6. spydon commented on Jul 1, 2024

    @spydon
    Contributor

    Also, is anyone here experiencing this issue on wayland? Thanks :D

    I tried on Wayland with the reproduction code and I see a CPU usage of 25% when it is idle (higher than Firefox with lots of tabs open for example).
    Then it goes up to around 50% when resizing the window and it also goes up to 30-35% when you just move around the mouse quickly over the application.

  7. alphaqu commented on Oct 19, 2024

    @alphaqu

    I am also experiencing this slowdown. On linux, wayland + hyprland.

    class _ImageBackgroundState extends State<ImageBackground>
        with SingleTickerProviderStateMixin {
      late AnimationController controller;
    
      @override
      void initState() {
        controller = AnimationController(
          duration: const Duration(seconds: 60),
          vsync: this,
        )
          ..forward()
          ..addStatusListener((status) {
            if (status.isCompleted) {
              controller.repeat();
            }
          });
        super.initState();
      }
    
      @override
      void dispose() {
        controller.dispose();
        super.dispose();
      }
    
      @override
      Widget build(BuildContext context) {
        return Container(
          color: Colors.black,
        );
    

    On removal of the animation controller code in initState, my cpu usage for the flutter application drops from 20% to 0.1%.

    Perf profilings

    Here are two profiling ive done with perf, (in a format which is openable by profiler.firefox.com), one with the code above, and another with the controller stuff commented out.

    with_animation.txt
    without_animation.txt

  8. lhoward commented on Mar 3, 2025

    @lhoward

    I believe we’re seeing something similar using the Sony embedder (OpenGL, no Impeller) both on desktop with Wayland, and embedded CM4 with DRM.

    Cc @prspn

  9. Qubitus commented on Mar 26, 2025

    @Qubitus

    I have the same issue, high CPU usage on idle (only displaying an application window).
    Just for info, when deployed to the browser I get a steady 60 FPS without any drops.
    When deployed as native Linux app, the FPS for full screen (4k) gets stuck at 10 FPS.
    The smaller I make the window, the higher the FPS counter goes.
    Nvidia hardware acceleration enabled and used... so seems something is choking CPU.

  10. bochelie1000 commented on Jul 23, 2025

    @bochelie1000

    I also have the same issue on Linux Desktop. No matter what type of animation or its size ect. It always uses >45% CPU as soon an animation is used.

    I see that this issue is very old. Will this be investigated?

  11. dreirund commented on Jun 28, 2026

    @dreirund

    Still relevant.

  12. dongfengweixiao commented on Jun 30, 2026

    @dongfengweixiao

    When playing videos on Linux using media_kit or other video playback components, the CPU usage can reach 20% or higher. In contrast, playing the same video with the mpv player typically results in only 5% CPU usage. This discrepancy is likely related to the underlying reasons for the differences in CPU efficiency between these video playback methods.

  13. spydon commented on Oct 25, 2026

    @spydon
    Contributor

    We have been having problems with this in Flame for ages, on Flutter main this is way better after @robert-ancell's work on the subsurface based view renderer though! I added another PR on top of his works that makes it on par with the other platforms.

    app gnome-shell
    master (66b3ad9) 16.4% 13.4%
    this PR 3.2% 2.8%
    3.47 stable, for reference 33.6% 5.9%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: animationAnimation APIsa: desktopRunning on desktopc: performanceRelates to speed or footprint issues (see "perf:" labels)engineflutter/engine related. See also e: labels.found in release: 2.10Found to occur in 2.10found in release: 2.13Found to occur in 2.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-linuxBuilding on or for Linux specificallyteam-linuxOwned by the Linux platform teamtriaged-linuxTriaged by the Linux platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions