redhat-developer / redhat-developer/vscode-java

start-up slow when opening a single .java file in empty workspace

Open
#2,666 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extension-start performance
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

Use case

Open VS Code without opening any folder. Drag a .java file into the window. Java extension is expected to work immediately, but it takes several seconds.

Let's see if we have chance to improve it.

I find some clues:

  • a) 2~3s after java extension starts to activate, JDTLS starts to write server logs. (client side code and launching JVM)
  • b) it's another 5s before JavaLanguageServerPlugin is started. (mostly related to OSGi?)
  • c) initialization and follow-up building jobs are finished within 1s.

Attaching the logs.

Extension host log
[2022-09-08 13:24:51.158] [exthost] [info] ExtensionService#_doActivateExtension redhat.java, startup: false, activationEvent: 'onLanguage:java'
JDTLS log
!SESSION 2022-09-08 13:24:53.994 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.4.1
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -data C:\Users\yanzh\AppData\Local\Temp\vscodesws_68b2c\jdt_ws

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-09-08 13:24:58.761
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-09-08 13:24:58.963
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-09-08 13:24:59.023
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-09-08 13:24:59.025
!MESSAGE Initializing Java Language Server 1.16.0.202209070809

...

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-09-08 13:24:59.741
!MESSAGE Creating the Java project jdt.ls-java-project

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-09-08 13:24:59.771
!MESSAGE >> initialized

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-09-08 13:24:59.921
!MESSAGE Finished creating the Java project jdt.ls-java-project

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-09-08 13:25:00.409
!MESSAGE Workspace initialized in 691ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-09-08 13:25:00.534
!MESSAGE >> initialization job finished

...

!ENTRY org.eclipse.jdt.ls.core 1 0 2022-09-08 13:25:00.833
!MESSAGE >> build jobs finished

...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the onLanguage:java activation and JDTLS launch, then inspect the interval before JavaLanguageServerPlugin starts, especially the OSGi initialization mentioned in the report. Reproduce the empty-workspace single-.java flow and compare the extension-host and JDTLS timestamps; done means the startup delay is reduced without delaying initialization or build completion.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript, vscode
Domain
developer-experience, performance, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.