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
I noticed that even on my M1 Mac the pre-commit hook to check formatting takes more than 10 seconds. I ran a Gradle build scan and looked at the performance:
It looks like a great deal of time is spent in top-level :spotlessGroovyGradle, :spotlessJava, and :spotlessMisc tasks. I wonder if these tasks are doing formatting checks redundant with similarly-named tasks defined for the sub-projects? If we could scope these top-level tasks to only include files not covered by a sub-project task that could speed things up.
As a workaround, since I mostly just edit Java source code, I run ./gradlew spotlessJavaApply to fix formatting (which skips format checking of Gradle and misc files), and then git commit --no-verify to skip the pre-commit hook.
The text was updated successfully, but these errors were encountered:
Also note that in the build scan, all the tasks are up to date; it takes 10 seconds just to do fingerprinting and confirm that the tasks do not need to be run. This is part of what makes me suspect that at least the inputs for the top-level tasks are too broad.
Fixes#6297
We make two key changes:
1. Split formatting of `.java` source files among individual sub-projects, so formatting / checking for each sub-project can run in parallel.
2. Remove exclusion patterns that start in `**`, which are expensive to evaluate.
With these changes, `./gradlew spotlessCheck` (which runs in the pre-commit script) runs much faster for me (on my M1 Mac the running time is reduced from ~9.2 seconds before this PR to ~2 seconds after).
To test, we add tasks named `printSpotlessTaskInputs` that print which files are being formatted. Using these tasks I confirmed that exactly the same files are being checked and formatted before and after this PR.
I noticed that even on my M1 Mac the pre-commit hook to check formatting takes more than 10 seconds. I ran a Gradle build scan and looked at the performance:
https://scans.gradle.com/s/uiupezpubbyf2/performance/execution
It looks like a great deal of time is spent in top-level
:spotlessGroovyGradle
,:spotlessJava
, and:spotlessMisc
tasks. I wonder if these tasks are doing formatting checks redundant with similarly-named tasks defined for the sub-projects? If we could scope these top-level tasks to only include files not covered by a sub-project task that could speed things up.As a workaround, since I mostly just edit Java source code, I run
./gradlew spotlessJavaApply
to fix formatting (which skips format checking of Gradle and misc files), and thengit commit --no-verify
to skip the pre-commit hook.The text was updated successfully, but these errors were encountered: