Skip to content

Improve flutter build latency on iOS #9199

Open

Description

@xster

flutter build ios takes 30+s on my monster mac pro. Would be nice to get it faster.

Some candidates:
100+ms to read the CFBundleIdentifier from the project
1000+ms to print the build settings to do some variable substitution. Maybe we can cache this.
400+ms to check cocoapods version. Maybe we can ask for forgiveness instead of permission
1900+ms to check cocoapods dependencies. Don't know if there's any caching we can use
22000+ms to run /usr/bin/env xcrun xcodebuild clean build -configuration Release ONLY_ACTIVE_ARCH=YES -workspace Runner.xcworkspace -scheme Runner BUILD_DIR=build/ios -sdk iphoneos -arch arm64. Do we really need to clean first?

Activity

  1. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    c: performanceRelates to speed or footprint issues (see "perf:" labels)
    platform-macosBuilding on or for macOS specifically
    platform-iosiOS applications specifically
    on Apr 4, 2017
  2. added this to the milestone on Apr 4, 2017
  3. xster commented on Apr 4, 2017

    @xster
    MemberAuthor

    Actually the 22000+ms has a 13000+ms snapshot build component. Removing clean doesn't make much of a difference. Would be worth looking deeper into the xcodebuild's outputs and timings

  4. modified the milestones: 3: Current Milestone, on Dec 6, 2017
  5. Hixie commented on Dec 6, 2017

    @Hixie
    Contributor

    This is not on our immediate list of priorities, moving to next milestone.

  6. added
    t: xcode"xcodebuild" on iOS and general Xcode project management
    and removed
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Jan 5, 2019
  7. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    and removed
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Jan 8, 2019
  8. jmagman commented on Aug 16, 2019

    @jmagman
    Member

    You can run with -showBuildTimingSummary:

    /usr/bin/env xcrun xcodebuild -configuration Release -workspace Runner.xcworkspace -scheme Runner -sdk iphoneos COMPILER_INDEX_STORE_ENABLE=NO -showBuildTimingSummary
    
    Build Timing Summary
    
    PhaseScriptExecution (2 tasks) | 22.193 seconds
    
    CompileC (8 tasks) | 2.454 seconds
    
    CodeSign (3 tasks) | 0.820 seconds
    
    CompileAssetCatalog (1 task) | 0.667 seconds
    
    CompileStoryboard (2 tasks) | 0.510 seconds
    
    Ld (2 tasks) | 0.198 seconds
    
    GenerateDSYMFile (1 task) | 0.079 seconds
    
    LinkStoryboards (1 task) | 0.014 seconds
    
    Touch (1 task) | 0.002 seconds
    
    CreateUniversalBinary (1 task) | 0.002 seconds
    

    Dominated by the xcode_backend script run.

  9. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  10. removed this from the milestone on Jun 2, 2020
  11. removed this from the milestone on Jun 2, 2020
  12. removed this from the milestone on Aug 17, 2020
  13. ezamagni-tg commented on Aug 22, 2025

    @ezamagni-tg

    We have a large project in which xcode_backend script occupies a pretty large time during iOS builds (~1 min out of 4+ min of build time).
    I was wondering how can we profile it to better inspect why it takes so long to execute.
    I was also wondering if it could be possible to parallelize it in any way with other steps of the build process.

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 listc: performanceRelates to speed or footprint issues (see "perf:" labels)platform-iosiOS applications specificallyplatform-macosBuilding on or for macOS specificallyt: xcode"xcodebuild" on iOS and general Xcode project managementteam-iosOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-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