Skip to content
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

Memoize scalafix instance across modules & invocations #175

Closed
bjaglin opened this issue Jan 7, 2024 · 0 comments · Fixed by #206
Closed

Memoize scalafix instance across modules & invocations #175

bjaglin opened this issue Jan 7, 2024 · 0 comments · Fixed by #206

Comments

@bjaglin
Copy link
Contributor

bjaglin commented Jan 7, 2024

val scalafix = Scalafix
.fetchAndClassloadInstance(scalaBinaryVersion, repositories.map(CoursierUtils.toApiRepository).asJava)

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.

@bjaglin bjaglin changed the title Memoize scalafix instantiation cost across modules & invocations Memoize scalafix instance across modules & invocations Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant