mill-scalafix
mill-scalafix copied to clipboard
Memoize scalafix instance across modules & invocations
https://github.com/joan38/mill-scalafix/blob/8179e4f4235279f2364a40350f1c592dfc4d9ecd/mill-scalafix/src/com/goyeau/mill/scalafix/ScalafixModule.scala#L53-L54
The scalafix instantiation above is very costly in terms of IO, but above all CPU as it effectively classloads Scalafix together with the entire scala standard library (with a cold JIT cache), even if scalafixScalaBinaryVersion
matches Mill's scala binary version.
I believe adding a Mill worker to hold this instance would greatly benefit to the perceived performance of scalafix on projects with multiple modules or for users calling scalafix repeatedly. sbt-scalafix does something similar almost from day one, and a while ago this regressed, causing a ~10x invocation runtime regression on builds with many modules.