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

improvement: Request jvmRunEnvironment lazily #6223

Merged
merged 1 commit into from Mar 18, 2024

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Mar 13, 2024

Previously, we would eagerly request jvmEnvironment for all known main classes, which in case of Bazel might cause a lot of queries. This might also not be efficient in some other cases. Now, we only request and cache jvmRunEnvironment when needed.

buildTargetClasses.jvmRunEnvironment
.get(target)
buildTargetClasses
.jvmRunEnvironmentSync(target)
Copy link
Member

Choose a reason for hiding this comment

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

Just a question, can we ask for jvmRunEnvironment here instead? This would remove the need for jvmRunEnvironmentSync, since jvmRunEnvironment can return cached results.

Or maybe waiting for the response here would be too long?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would rather avoid using Await here and using Future propagates it all the way and it becomes quite complex. There are multiple sequences of futures etc.

Copy link
Contributor

@kasiaMarek kasiaMarek left a comment

Choose a reason for hiding this comment

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

I see you' re caching jvmRunEnvironments but I don't see you ever updating or clearing that cache.

@tgodzik
Copy link
Contributor Author

tgodzik commented Mar 14, 2024

I see you' re caching jvmRunEnvironments but I don't see you ever updating or clearing that cache.

Goo catch, I added it to indexWorkspace alongside when we clear all indexer data, since it should be refreshed around the same time.

Previously, we would eagerly request jvmEnvironment for all known main classes, which in case of Bazel might cause a lot of queries. This might also not be efficient in some other cases. Now, we only request and cache jvmRunEnvironment when needed.
Copy link
Member

@jkciesluk jkciesluk left a comment

Choose a reason for hiding this comment

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

lgtm

@tgodzik tgodzik merged commit fe1aff2 into scalameta:main Mar 18, 2024
25 of 26 checks passed
@tgodzik tgodzik deleted the lazyenv branch March 18, 2024 10:34
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.

None yet

3 participants