Skip to content

Slow first-frame startup performance on desktop Linux #118911

@vially

Description

@vially

Details

On desktop Linux, it takes a significant amount of time for the first Flutter frame to render inside the newly created window.

In practice, it means the user is looking at a blank window for a couple of seconds until the first Flutter frame is rendered (as seen in the video recording below).

This is reproducible on multiple machines (using reasonably powerful hardware), on multiple channels (stable/master) and for all build modes (debug/profile/release).

Steps to reproduce

The issue is reproducible using the default Linux desktop app template without any code changes.

  1. Create new demo project
flutter create --platforms=linux flperfdemo
  1. Run the demo project on desktop Linux
flutter run -d linux

After the native (GTK) window is opened, it takes around 4-5 seconds for the first Flutter frame to render inside the window.

Contents of start_up_info.json when running with flutter run --trace-startup --profile:

{
  "engineEnterTimestampMicros": 6724731208,
  "timeToFrameworkInitMicros": 2271098,
  "timeToFirstFrameRasterizedMicros": 4756373,
  "timeToFirstFrameMicros": 4747155,
  "timeAfterFrameworkInitMicros": 2476057
}

Timeline trace when running with flutter run --profile: https://gist.github.com/vially/fddc530844b16456bee986a56c791f2c

Video recording

desktop-linux-slow-first-frame.webm

Target Platform: Linux
Target OS version/browser: Arch Linux
Devices: Linux Desktop (linux-x64)
Display server: Wayland (sway)
Graphic drivers: Mesa 22.3.3
Hardware specs:

  • CPU: AMD Ryzen 9 3950X
  • GPU: AMD Radeon RX 6700 XT

Logs

Logs
Analyzing flperfdemo...
No issues found! (ran in 2.3s)
[✓] Flutter (Channel stable, 3.3.10, on Arch Linux 6.1.6-arch1-3, locale en_US.UTF-8)
    • Flutter version 3.3.10 on channel stable at /home/vially/.local/share/flutter-sdk
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 135454af32 (5 weeks ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0

[✓] Linux toolchain - develop for Linux desktop
    • clang version 15.0.7
    • cmake version 3.25.2
    • ninja version 1.11.1
    • pkg-config version 1.8.0

[!] Flutter IDE Support (No supported IDEs installed)
    • IntelliJ - https://www.jetbrains.com/idea/
    • Android Studio - https://developer.android.com/studio/
    • VS Code - https://code.visualstudio.com/

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Arch Linux 6.1.6-arch1-3

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

! Doctor found issues in 1 category.
{
  "engineEnterTimestampMicros": 6724731208,
  "timeToFrameworkInitMicros": 2271098,
  "timeToFirstFrameRasterizedMicros": 4756373,
  "timeToFirstFrameMicros": 4747155,
  "timeAfterFrameworkInitMicros": 2476057
}

https://gist.github.com/vially/fddc530844b16456bee986a56c791f2c

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: desktopRunning on desktopc: performanceRelates to speed or footprint issues (see "perf:" labels)engineflutter/engine related. See also e: labels.platform-linuxBuilding on or for Linux specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions