Skip to content

Optimize search for the default App bundle on macOS #122028

@jmagman

Description

@jmagman

+[NSBundle bundleWithIdentifier] is slow, and scales to the size of the app. On iOS flutter/engine#39975 searches within the privateFrameworksURL where the default bundle is expected to be located first, then falls back to +bundleWithIdentifier. When tested internally, this improves startup of customer: chalk by 30% on iOS - see http://shortn/_WcifhO48X6.

I suspect macOS could benefit from the same optimization:

https://github.com/flutter/engine/blob/706fd9cc2dd83e84018e6584f0fc595b8c489457/shell/platform/darwin/macos/framework/Source/FlutterDartProject.mm#L29

@jiahaog said:

I don't have a setup for profiling macOS apps now so I can't say for sure now, but I would expect this to also happen there – we should perhaps follow up separately. It seems like Chrome also encountered this problem on macOS - see GetFrameworkBundlePath (L156) of https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_paths_mac.mm.

flutter/engine#39975 (comment)

cc @cbracken

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: desktopRunning on desktopplatform-macBuilding on or for macOS specificallyteam-macosOwned by the macOS platform teamtriaged-macosTriaged by the macOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions