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

Copy bytes directly instead of using scala.reflect.io.Streamable #1395

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

rochala
Copy link
Contributor

@rochala rochala commented Sep 11, 2024

scala.reflect.io.Streamable is way slower than copying bytes directly. Depending on buildtool implementations of VirtualFile and FileConverter the code path may end up running this method which for smaller files (1Kb) is 10x slower and for larger ones (20Kb+) even 20x slower. This can add up for bigger codebases.

Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

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

Thanks!

Please note that both Scala 2.13 and Scala 3 have their own compiler bridges now.

@eed3si9n eed3si9n merged commit 5a7012f into sbt:1.10.x Sep 11, 2024
8 checks passed
@rochala
Copy link
Contributor Author

rochala commented Sep 12, 2024

Thanks!

Please note that both Scala 2.13 and Scala 3 have their own compiler bridges now.

Oh, I wasn't aware of this. I can't find Scala 3 bridge sources, do you mind sharing the link to them ?

@lrytz
Copy link
Contributor

lrytz commented Sep 12, 2024

IIRC, Scala 3 rewrote the compiler bridge in Java: https://github.com/scala/scala3/tree/main/sbt-bridge/src

With what you know / learned by creating this PR, maybe you can find out if a similar change is needed in Scala 3 as well.

@rochala
Copy link
Contributor Author

rochala commented Sep 12, 2024

Scala 3 is not using reflect.io API at all, so it should not be affected

@lrytz
Copy link
Contributor

lrytz commented Sep 12, 2024

👍 thanks. Are you going to submit a forward-port to 2.13? https://github.com/scala/scala/blob/2.13.x/src/sbt-bridge/scala/tools/xsbt/AbstractZincFile.scala

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