Skip to content

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

Open
@Eskibear

Description

@Eskibear

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

...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions