Skip to content

fix(tool): initialize asset isModified state on startup to prevent 2x hot restart slowdown#187488

Open
kevmoo wants to merge 2 commits into
flutter:masterfrom
kevmoo:i187391_hot_slow
Open

fix(tool): initialize asset isModified state on startup to prevent 2x hot restart slowdown#187488
kevmoo wants to merge 2 commits into
flutter:masterfrom
kevmoo:i187391_hot_slow

Conversation

@kevmoo
Copy link
Copy Markdown
Contributor

@kevmoo kevmoo commented Jun 3, 2026

Prior to this fix, the first hot restart would incorrectly detect all assets as modified and sync/recompile all of them. This was because DevFS.updateBundle bypassed the asset loop during the initial application startup, which prevented the stateful isModified getter from being initialized.

This fix accesses isModified for each asset in the bundle during startup to initialize the cache, matching the behavior before the asset processing refactor.

Fixes #187391

… hot restart slowdown

Prior to this fix, the first hot restart would incorrectly detect all assets as modified and sync/recompile all of them. This was because DevFS.updateBundle bypassed the asset loop during the initial application startup, which prevented the stateful isModified getter from being initialized.

This fix accesses isModified for each asset in the bundle during startup to initialize the cache, matching the behavior before the asset processing refactor.

Fixes flutter#187391
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 3, 2026
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jun 3, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates DevFS.updateBundle to initialize the isModified state of assets during the first upload when syncing is skipped, preventing unnecessary recompilation on subsequent hot restarts. A corresponding test was added to verify this behavior. The review feedback suggests simplifying the asset iteration in DevFS.updateBundle by iterating directly over bundle.entries.values instead of bundle.entries.entries since the keys are not used.

Comment thread packages/flutter_tools/lib/src/devfs.dart Outdated
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tool] 2x slowdown in hot restart

1 participant