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

faster plugin startup #336

Closed
snovo opened this issue Oct 18, 2017 · 12 comments
Closed

faster plugin startup #336

snovo opened this issue Oct 18, 2017 · 12 comments

Comments

@snovo
Copy link

snovo commented Oct 18, 2017

this extension is great but it takes far too much time to be ready as it seems to be rebuilding the workspace everytime a new project/folder is loaded.
opening a medium size project takes up to 15min to rebuild the workspace...

wondering if it wouldn't be possible to reuse the workspace from the last session and provide an option to rebuild the workspace if necessary...

Environment
  • Operating System: windows 10
  • JDK version: 1.8
  • Visual Studio Code version: 1.17.1 x64
  • Java extension version: 0.11
Steps To Reproduce
  1. open a medium/large folder.

current folder structure takes up to 15minutes to load:
capture

@fbricon
Copy link
Collaborator

fbricon commented Oct 22, 2017

vscode-java already reuses the same workspace than the last time the folder was opened.

From what I see in your screenshot, there doesn't seem to be many Maven modules, unless there's a deeper module hierarchy. So 15min to rebuild seems really excessive.
Exactly how many Maven modules do you have, how many java files? Any chance you could share your pom.xmls, so that we can see if some rogue Maven plugins are slowing down the build? Any way you can reproduce the issue with an open source project?

@snovo
Copy link
Author

snovo commented Oct 24, 2017

My development machine is actually a VM and I do have a bunch of VSCode extensions active alongside with vscode-java.
I did disable all extensions but vscode-java and unfortunately, the outcome is pretty much the same. I also tried it out on my host machine and it's faster, but I noticed something weird while testing it. It seems that cleaning up the workspace before opening VSCode makes it faster!

I have been trying to get some measurements either using my project and also this one https://github.com/google/guava, both on my VM and host machine with only vscode-java extension enabled. The following are some average measurements of time the vscode-java needs to be ready:

Host machine:
Project | No previous workspace | Previous workspace present (supposedly reusing it)

My own | about 9 minutes | about 10 minutes --> 40 seconds slower on average
Guava | about 1 min and 40 sec | about 2 minutes --> 20 seconds slower on average

VM machine:
Project | No previous workspace | Previous workspace present (supposedly reusing it)

My own | about 14 min and 20 sec | about 17 minutes --> 3 minutes slower on average
Guava | about 5 min and 30 sec | about 7:20 minutes --> 2 minutes slower on average

These results are reproducible on my machine.
None of the projects takes more than 2minutes when compiled from scratch using the command "mvn clean compile" on a powershell/CMD instance (I understand vscode-java does more than just compiling the projects).

My project has 12 modules and 506 java files (not as big as I thought)
Guava seems to have 9 modules and 3432 java files

I can't share the original pom files, but I'm happy to share them with the project and company names "obfuscated".

POMs.zip

@fbricon
Copy link
Collaborator

fbricon commented Oct 24, 2017

@snovo so CLI build takes 2 mins max in your VM?

@fbricon
Copy link
Collaborator

fbricon commented Oct 24, 2017

@snovo what do you measure exactly to determine the build is finished in vscode?

@fbricon
Copy link
Collaborator

fbricon commented Oct 24, 2017

Windows always had terrible terrible I/O perf, I see that hasn't changed with Win 10 apparently :-(

Running mvn clean test-compile would be a more accurate comparison with what vscode-java actually does. It takes 40sec to compile all files from guava on my MacBook Pro from CLI.

Looking at the Language Support for Java output logs, between the 1st line to the last one after server reaches 100% startup, a "cold" import takes about 47sec, and a "hot" one is about 10sec slower. So this definitely doesn't work as expected. It should be much faster instead.

@snovo
Copy link
Author

snovo commented Oct 24, 2017

Hi fbricon,

As a measurement, I was looking for the status progress (percentage) of the extension and calculating the difference between the time it reaches 100% and when the percentage first showed up in the UI.

Btw, I just tried out "mvn clean test-compile" with guava and it took 1:47 min. Executing "mvn test-compile" took 40seconds afterwards.
Quite slower than on your's MacBook... My machine still uses a standard SATA SSD as opposite to the M.2.
With the project I'm working on it took 3:42 min to run "mvn clean test-compile" and 16sec to run "mvn test-compile" afterwards.

You can find the vscode-java log file for guava which contains 2 sessions. The first one is related to a clean compilation and the second one related to a hot compilation (reusage of the workspace):
vscode-java.log

I used to use IntelliJ and it was much faster after the cold/clean compilation. That's why I thought the workspace wasn't being reused at all.

@fbricon
Copy link
Collaborator

fbricon commented Oct 24, 2017

I think the problem comes from our systematic re-import of the projects, when the workspace is reopened. If the projects already exist in the underlying workspace, we might just refresh them and stop there. Hopefully that might help.

@fbricon
Copy link
Collaborator

fbricon commented Oct 24, 2017

So even when skipping the maven import when the project already exists, it still takes a minute to start. The server seems to execute a full build, which is what's taking a very long time to run.
Guess I'll need to dig more

@snovo
Copy link
Author

snovo commented Oct 26, 2017

let me know if you need more info

@fbricon
Copy link
Collaborator

fbricon commented Oct 26, 2017

@snovo still banging my head on it

fbricon added a commit to fbricon/eclipse.jdt.ls that referenced this issue Oct 26, 2017
Also, avoid importing already existing Maven projects and trigger "Update project
configuration" asynchronously to reduce server startup response time.

When opening https://github.com/google/guava a 2nd time the server is ready in ~2-3 sec,
instead of 1min.

Fixes redhat-developer/vscode-java#336

Signed-off-by: Fred Bricon <fbricon@gmail.com>
fbricon added a commit to fbricon/eclipse.jdt.ls that referenced this issue Oct 30, 2017
Also, avoid importing already existing Maven projects and trigger "Update project
configuration" asynchronously to reduce server startup response time.

When opening https://github.com/google/guava a 2nd time the server is ready in ~2-3 sec,
instead of 1min.

Fixes redhat-developer/vscode-java#336

Signed-off-by: Fred Bricon <fbricon@gmail.com>
fbricon added a commit to eclipse-jdtls/eclipse.jdt.ls that referenced this issue Oct 30, 2017
Also, avoid importing already existing Maven projects and trigger "Update project
configuration" asynchronously to reduce server startup response time.

When opening https://github.com/google/guava a 2nd time the server is ready in ~2-3 sec,
instead of 1min.

Fixes redhat-developer/vscode-java#336

Signed-off-by: Fred Bricon <fbricon@gmail.com>
@fbricon fbricon added this to the End October 2017 milestone Oct 30, 2017
@fbricon
Copy link
Collaborator

fbricon commented Oct 31, 2017

You can download the most recent java-<version>.vsix file containing the fix and install it by following the instructions here.

@fbricon fbricon added enhancement and removed bug labels Nov 1, 2017
@kuntergunt
Copy link

Try to disable virus scanning on the project folder if you trust the sources. That helped to speed up my build times a lot.

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