Repository navigation
Conversation
|
Here is one fixable problem for thread-safety: The other possible problem is inside the formatters themselves. IMO, the Spotless workflow is:
That has always been true on Gradle, and now it is also true on Maven. IMO, parallel formatting as a first-class citizen is a bad tradeoff, because it adds complexity everywhere but the only place it brings real value is in the first run, which is not where developers spend most of their time. I'd be fine with adding a |
|
I agree with your reasoning. Parallel formatting could significantly increase code complexity. It would only improve the first run and clean runs (e.g. I'll close this experiment. Thanks for your input! |
POC to gather feedback about parallelizing execution of
Formatters in the Maven (and perhaps Gradle) plugin.I tested this change on https://github.com/neo4j/neo4j codebase with the following simple configuration:
On my Mac with an SSD drive, command
mvn spotless:applytakes:The speedup looks promising, but it will likely vary significantly depending on the configured formatters and hard drive.
Implementation notes:
UpToDateCheckerbecause it is not thread-safe (for now)FormattingParallelizeris a singleton to make sure the plugin does not create too many thread pools. E.g. avoid creating 3 pools for each Maven modulePerhaps the logic to read-format-write can be shared between Maven and Gradle plugins. Then, both would benefit from such parallelization.
What do you think about parallelizing formatters? Are formatter instances typically thread-safe?
Any input is much appreciated :)