You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[flutter_plugin_tools] Investigate and reduce overhead of execution in pre-commit hook #188870
While implementing a pre-commit git hook in PR #11941, we observed a significant overhead (approximately 5 seconds) when invoking the analyze and format commands provided by flutter_plugin_tools; see comment for details. To mitigate this for the common case of committing non-package changes, we implemented an optimization in the hook to skip the tool execution if no staged package changes are detected. However, this overhead still affects commits that do contain package changes, making the git commit experience sluggish.
We should investigate why invoking the tool introduces this latency (maybe Dart VM startup, package resolution, or something else) and how to reduce it. Ideally, we could then remove the optimization from the pre-commit hook.
Were you running whole-repo format? That's a pretty expensive command because it has to run the Dart formatter package by package, and also has to spin up all the native formatters (which includes a JVM twice).
I added a flag in the PR to only run on packages with staged changes and I also added an optimization for format to only set up the native formatters if native files were changed, so the slowdown is coming from elsewhere I believe.
Activity
stuartmorgan-g commentedon Jul 1, 2026
Were you running whole-repo
format? That's a pretty expensive command because it has to run the Dart formatter package by package, and also has to spin up all the native formatters (which includes a JVM twice).camsim99 commentedon Jul 1, 2026
I added a flag in the PR to only run on packages with staged changes and I also added an optimization for
formatto only set up the native formatters if native files were changed, so the slowdown is coming from elsewhere I believe.[camera_android_camerax] Check Git hooks configuration in check-readi…
[camera_android_camerax] Check Git hooks configuration in check-readi…
[camera_android_camerax] Check Git hooks configuration in check-readi…