Take 3s to go to definition for symbol of internal package
In vscode: For symbol of internal package (the package that I'm coding), it takes 3s to jumps to the definition. For symbol of external packages (packages that are in vendor) , it jumps nearly instantly.
macOS High Sierra 10.13.16
$ go-langserver -version
v3-dev
$ code --version
1.27.2
f46c4c469d6e6d8c46f268d1553c5dc4b475840f
x64
Can you include your go config for vscode? Any diagnostic output to help diagnose? Is this in OSS, so I can try reproduce?
Here is my go config
"go.docsTool": "gogetdoc",
"go.languageServerExperimentalFeatures": {
"autoComplete": true,
},
"go.languageServerFlags": [
"-diagnostics",
],
"go.useLanguageServer": true,
go-langserver output:
langserver-go: reading on stdin, writing on stdout
Passing an initialize rootPath URI ("file:///Users/anphung/go/src/github.com/anphung/mypackage") is deprecated. Use rootUri instead.
If sub package (e.g.: github.com/anphung/mypackage/controller) inside mypackage contains small number of files (around ~20 files), It jumps fast.
If sub package contains big number of files (> 150 files, each file has 10 definitions), it jumps slow.
I guess that's the limit.
Sorry, It's not OSS.
If you remove the -diagnostics flag is it faster?
It was running slow without it. tried to add it to see if there is some info, but no info.
Thanks for the information. This should still be fast regardless. I'll check if we have regressed on which j2d engine we use with your flags (we have a slower one which is more correct, but by default we should be using a godef based j2d).
Thanks for checking :)
We haven't regressed here. I'm unsure how deep you want to get into this, but a pprof profile of what its doing to take that long would be amazing. https://github.com/sourcegraph/go-langserver#profiling
Here we go.
"go.languageServerExperimentalFeatures": {
// "autoComplete": true,
},
"go.languageServerFlags": [
"-pprof",
"localhost:6060",
],
"go.useLanguageServer": true,
- Click on a symbol in vscode
- Immediately go to terminal and run the
go tool pprof...
Ah, it's like this, try to jump to Definition of:
definitionGodefhttps://github.com/sourcegraph/go-langserver/blob/master/langserver/definition.go#L25 andLocationhttps://github.com/sourcegraph/go-langserver/blob/master/langserver/definition.go#L29
Location got jumped into immediately, definitionGodef has a little delay.
Maybe it's because package github.com/sourcegraph/go-langserver/langserver is more complex than package github.com/sourcegraph/go-langserver/pkg/lsp.
I guess if a package (excluding children package) is to big, it'll be slow because of i/o bottle neck. So, it's not about internal vs. external package.