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

Slow workspace initialization and reference search in large Gradle monorep #3904

Open
idandam opened this issue Dec 25, 2024 · 4 comments
Open
Assignees

Comments

@idandam
Copy link

idandam commented Dec 25, 2024

Description

Each time I start VSCode, the Java Language Server re-initializes the workspace which takes a considerable amount of time. During this initialization period, I cannot:

  • Navigate to object references
  • See method callers/usages
  • Use other indexing-dependent features

Even after indexing is complete, searching for references takes several seconds to display results, which is significantly slower compared to IntelliJ.

Project Structure

  • Type: Monorepo with root project and multiple modules
  • Build Tool: Gradle

Current Setup

  • Extensions installed:
    • Gradle for Java
    • Java Language Server

What I've tried

  • Setting "java.import.gradle.enabled": false - This didn't help as it prevented project importing altogether, making indexing features unavailable
  • Default settings with "java.import.gradle.enabled": true - Works but very slow initialization

Expected Behavior

  • Faster workspace initialization on startup
  • Quick reference search response (similar to IntelliJ performance)
  • Persistence of indexing between editor sessions

Actual Behavior

  1. Every editor restart triggers full workspace reinitialization
  2. Reference search takes several seconds to display results
  3. Unable to use navigation features during initialization

Environment

  • OS: macOS Ventura 13.1
  • Java Language Server Extension Version: 1.38.0
  • Gradle for Java Extension Version: 3.16.4
  • VSCoder Version: 1.93.1
  • JDK Version: Amazon Coretto 1.8

Additional Context

This is affecting development productivity significantly, especially when working with large codebases that require frequent navigation between references and implementations.

Question

Is there a way to:

  1. Persist the indexing between editor sessions?
  2. Optimize the reference search performance?
  3. Configure selective indexing for specific modules while maintaining full functionality?
@snjeza
Copy link
Contributor

snjeza commented Dec 27, 2024

@idandam Could you, please, try VS Code 1.40.0 ?

@rgrunber
Copy link
Member

It would be good if @idandam could let us know if this improves the situation (fix is in the vscode-java pre-release builds, or by trying the vsix referenced above). The only thing I could confirm is that this eliminates some possible deadlocks.

@idandam
Copy link
Author

idandam commented Jan 18, 2025

@snjeza @rgrunber
can't confirm i see an improvement with the attached vsix after installing it.

opening the java projects takes almost 5-8 minutes, event if only existing and entering vscode.

slow references - see specific methods references is slow (approx 30 seconds to find 16 references that calls a specific method)

i have about 40 modules, each containing a gradle build configuration. All contained inside the root project with the main gradle build configuration. Is there a way to tell java language server to ignore a subset of modules for better performance ?, I can exclude modules in gradle since i could not find any working solutions (exclusion of modules) using any of the properties the java language server provides.

@snjeza
Copy link
Contributor

snjeza commented Jan 18, 2025

can't confirm i see an improvement with the attached vsix after installing it.

@idandam You can use VS Code pre-release.

opening the java projects takes almost 5-8 minutes, event if only existing and entering vscode.

Could you try the steps at #3917 (comment)

i have about 40 modules, each containing a gradle build configuration. All contained inside the root project with the main gradle build configuration. Is there a way to tell java language server to ignore a subset of modules for better performance ?, I can exclude modules in gradle since i could not find any working solutions (exclusion of modules) using any of the properties the java language server provides.

You can use "java.import.exclusions". See #2537 for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants