Description
I am trying to speed up our CI, which runs stuff like scalafix and scalafmt. scalafmt (with our Mill task, at least) is able to use caching to prevent unnecessary work (inital checks may take a few minutes; further checks with no/small diffs take ~seconds).
Most PRs in CI only change a small percentage of files, so there shouldn't be much to format or fix.
I noted in the documentation there are the --diff
and --diff-base branch/tag/commit
options for scalafix. I expected that:
- files not in git diff would not be checked
- possibly even better, only changed content in added/modified/renames would need to be checked
- the above would presumably make scalafix much faster with the
--diff
options, when the percentage of files changed is small. This assumes git is fast, and scalafix has some intense work to do.
I have read your CliGitDiffSuite tests, and it looks like functionality for 1 & 2 is there.
However, at least through the mill-scalafix plugin, --diff
actually seems to slow things down.
Here is a link to an issue I opened in mill-scalafix. From a few runs, it looks like --diff
is about 50% slower.
In this scalafix repo I tried sbt "scalafixAll --check"
and sbt "scalafixAll --check --diff-base main
, and didn't see much difference in time taken (even with no diff, on a branch off of main
).