Skip to content

Move Bsp to a separate worker - #6853

Merged
lihaoyi merged 4 commits into
com-lihaoyi:mainfrom
re-thc:comp
Feb 20, 2026
Merged

lihaoyi merged 4 commits into
com-lihaoyi:mainfrom
re-thc:comp

Conversation

@re-thc

@re-thc re-thc commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Was looking into cold start performance and Bsp downloads a lot of libs before anything happens (and likely isn't used in a lot of paths).

This moves it to a worker.

@lihaoyi

lihaoyi commented Feb 19, 2026

Copy link
Copy Markdown
Member

Can you report what the difference in the number of libs downloaded is with and without this PR, and their total size in mb/gb?

@re-thc

re-thc commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor Author

@lihaoyi

On main: 73.79MB
On this PR: 66.02MB

So saved 7.4MB (that's about 10%)

Big changes: jgit, guava, gson, bsp4j, lsp4j

It's not just download size and download time. Coursier also has to hash and analyze them.

@lefou

lefou commented Feb 19, 2026 •

Copy link
Copy Markdown
Member

@lihaoyi

On main: 73.79MB On this PR: 66.02MB

So saved 7.4MB (that's about 10%)

Big changes: jgit, guava, gson, bsp4j, lsp4j

It's not just download size and download time. Coursier also has to hash and analyze them.

If not for the size, I find i good thing to not have these deps on the default classpath.

@lihaoyi

lihaoyi commented Feb 19, 2026

Copy link
Copy Markdown
Member

@lefou this stuff is on the daemon classpath, not on the build.mill classpath, so apart from the download size this change wouldn't affect users at all

@lefou lefou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have a deep look at the implementation changes and probably wont in a timely manner. Just two small comments below.

Comment on lines +531 to +525
): (BspServerHandle, BuildClient) = {
): (BspServerHandle, AnyRef) = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we introduce some type here? AnyRef screams for trouble and doesn't help at all when reading the code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

import mill.client.lock.Lock
import mill.util.{BuildInfo, Jvm}

private object BspIdeaWorkerSupport {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe replace the BspIdea with Ide.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@re-thc

re-thc commented Feb 19, 2026

Copy link
Copy Markdown
Contributor Author

Context is I'm trying to migrate from Gradle. On cold start it's easily 8x slower on a build. Pretty significant. This triggers on CI or other use cases. Did some profiling and trying to reduce it. So the download size is a thing.

A separate topic, but the caching and remote caching has come up in other topics and so far it doesn't really resolve it so I'm trying to tackle cold starts 1st.

@lihaoyi
lihaoyi merged commit e1ecfdf into com-lihaoyi:main Feb 20, 2026
34 of 35 checks passed
@lihaoyi

lihaoyi commented Feb 20, 2026

Copy link
Copy Markdown
Member

Thanks @re-thc !

@lefou lefou added this to the 1.1.3 milestone Feb 20, 2026
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 this pull request may close these issues.

3 participants