Skip to content

Posix: Use aot-snapshot if FLUTTER_TOOLS_USE_AOT_SNAPSHOT=1 #170488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

matanlurey
Copy link
Contributor

I've added a flag, off by default, to use aot-snapshot when compiling/running flutter:

# On POSIX only, I have not done it for Windows (shared.bat) yet.
export FLUTTER_TOOLS_USE_AOT_SNAPSHOT=1
flutter --version

@jonahwilliams mentioned that the compile cost would be higher, and he's right:

$ time FLUTTER_TOOLS_USE_AOT_SNAPSHOT=0 flutter --version
Building flutter tool...
Resolving dependencies... (1.0s)
Downloading packages... 
Got dependencies.
Flutter 3.33.0-1.0.pre.465 • channel master • unknown source
Framework • revision ee089d09b2 (2 hours ago) • 2025-06-11 20:48:48 +0000
Engine • revision ee089d09b2 (2 hours ago) • 2025-06-11 20:48:48 +0000
Tools • Dart 3.9.0 (build 3.9.0-220.0.dev) • DevTools 2.48.0-dev.0
FLUTTER_TOOLS_USE_AOT_SNAPSHOT=0 flutter --version  0.35s user 0.22s system 3% cpu 14.477 total

$ time FLUTTER_TOOLS_USE_AOT_SNAPSHOT=1 flutter --version
Building flutter tool...
Resolving dependencies... 
Downloading packages... 
Got dependencies.
Flutter 3.33.0-1.0.pre.465 • channel master • unknown source
Framework • revision ee089d09b2 (2 hours ago) • 2025-06-11 20:48:48 +0000
Engine • revision ee089d09b2 (2 hours ago) • 2025-06-11 20:48:48 +0000
Tools • Dart 3.9.0 (build 3.9.0-220.0.dev) • DevTools 2.48.0-dev.0
FLUTTER_TOOLS_USE_AOT_SNAPSHOT=1 flutter --version  0.32s user 0.33s system 1% cpu 32.848 total

So, roughly twice as long to compile initially on my Macbook M1 Max laptop.

I'm considering letting others try it and give feedback, and if we like the behavior, we could do anything such as making it the default on master, or deciding it's not worth it and reverting the behavior entirely.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant