-
Notifications
You must be signed in to change notification settings - Fork 466
Maven plugin unnecessarily slow when using ratcheting #701
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
Comments
You are exactly correct about how it works. We get all the files, and then we filter them using git. spotless/plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java Lines 140 to 148 in ffb0d55
I would be surprised but not shocked if it were faster to swap the order. Some stats which would be interesting:
One thing that Regardless, PRs welcome :) |
Thanks for the reply, took a look at the code after posting (better late than never...) and realized it was indeed the case. If this was to be changed, the files would be retrieved from the I'll get back to this with some stats when I have the time, I've currently been running it in a remote VM, but I'd like to try it locally too, maybe even do a bit of profiling if I can get such a setup to work. |
I agree conceptually. In terms of implementation, I suspect it would be better performance and easier to build if you dropped |
Something which hadn't occurred to me: it's not actually spotless/lib-extra/src/main/java/com/diffplug/spotless/extra/GitRatchet.java Lines 206 to 214 in 8d822d0
If you don't do the diff relative to the merge base, you will bring back an old bug, #627. Luckily, you could call |
Thanks to @eriklumme for a great PR! Released in |
Running e.g.
spotless:check
with ratcheting enabled takes almost 20 seconds on one of my projects, even when no files have been modified.As it runs other projects much quicker, it leads me to believe that the number of files is the issue.
I believe it currently gathers all files matching the
include
patterns first, and afterwards matches against what has actually been modified. I'd like being able to configure it to do the opposite, i.e. start with the files that have been modified, and filter them based on theinclude
patterns.Perhaps this would be an issue when a large number of files that do not match the
include
patterns have been modified.The text was updated successfully, but these errors were encountered: