Skip to content

flutter pub get performance regression in large workspaces (introduced in #170517) #184515

Description

@aNOOBisTheGod

Steps to reproduce

  1. clone the repo https://github.com/aNOOBisTheGod/too-long-post-pub-get
  2. use flutter version that supports workspaces (after 3.32)
  3. run flutter pub get

a0e30bf added post-processing after pub get that iterates every workspace root package and calls regeneratePlatformSpecificTooling() for each. For packages with platform support (plugins, example apps), this triggers findPlugins() per package, which:

  • Reads and parses package_config.json from disk — once per findPlugins call, called twice per package (once in refreshPluginsList, once in injectPlugins)
  • Reads and parses every dependency's pubspec.yaml from disk — once per dep per call
  • Reloads .dart_tool/package_graph.json from disk — once per computeTransitiveDependencies call

In a workspace with 500 plugins + 500 example apps (each depending on ~50 siblings), this results in roughly 50,000+ redundant file reads during a single pub get. All of these files are shared across packages in the workspace and could be loaded once and reused.

In our production application, after workspaces migration, pub get takes 6+ minutes, which is incredibly long

Expected results

pub get completes in ~10–20s

Actual results

pub get takes 2+ minutes

Code sample

https://github.com/aNOOBisTheGod/too-long-post-pub-get

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

fvm flutter doctor -v
[✓] Flutter (Channel stable, 3.41.6, on macOS 26.3 25D125 darwin-arm64, locale en) [458ms]
   • Flutter version 3.41.6 on channel stable at /Users/anoobis/fvm/versions/3.41.6
   • Upstream repository https://github.com/flutter/flutter.git
   • Framework revision db50e20168 (8 days ago), 2026-03-25 16:21:00 -0700
   • Engine revision 425cfb54d0
   • Dart version 3.11.4
   • DevTools version 2.54.2
   • Pub download mirror https://pub.dev
   • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, no-cli-animations, enable-native-assets, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [2.2s]
   • Android SDK at /Users/anoobis/Library/Android/sdk
   • Emulator version 35.5.10.0 (build_id 13402964) (CL:N/A)
   • Platform android-36, build-tools 36.0.0
   • ANDROID_HOME = /Users/anoobis/Library/Android/sdk
   • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
     This is the JDK bundled with the latest Android Studio installation on this machine.
     To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
   • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
   • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.2) [1,389ms]
   • Xcode at /Applications/Xcode.app/Contents/Developer
   • Build 17C52
   • CocoaPods version 1.16.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) [5ms]
   ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Connected device (2 available) [6.7s]
   • iPhone 17 Pro Max (mobile) • FC8688E6-6467-4D7D-9FD2-F130419B1CE4 • ios          • com.apple.CoreSimulator.SimRuntime.iOS-26-3 (simulator)
   • macOS (desktop)            • macos                                • darwin-arm64 • macOS 26.3 25D125 darwin-arm64
   ! Error: Browsing on the local area network for Creeper. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
     The device must be opted into Developer Mode to connect wirelessly. (code -27)
   ! Error: Browsing on the local area network for Saul Goodman. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
     The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources [1,131ms]
   • All expected network resources are available.

! Doctor found issues in 1 category.

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)team-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions