Skip to content

perf(gopls): lazy cache initialization #2671

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

Closed
wants to merge 1 commit into from

Conversation

cljoly
Copy link

@cljoly cljoly commented Jun 13, 2023

On my machine, prior to this patch, gopls requires more than 38ms to
load (even after multiple starts of neovim):

077.729  038.355  038.355: require('lspconfig.server_configurations.gopls')

while the other servers take tens of millisecond.

After implementing this change, gopls takes about the same time as the
others:

033.563  000.163  000.163: require('lspconfig.server_configurations.gopls')

I have tried to replace go env GOMODCACHE with
echo /home/cjoly/go/pkg/mod but it’s just as slow. I suspect that the
call to system() is so slow because I use the fish shell. If I change
the 'shell' setting to 'sh', the issue disappears. Nonetheless, it’s
probably worth fixing, since this change is not very complex IMO, even
if my configuration is somewhat exotic.

I’ve checked that this change does not make using the 'sh' shell slower
and that the LSP still initializes properly.

On my machine, prior to this patch, gopls requires more than 38ms to
load (even after multiple starts of neovim):
```
077.729  038.355  038.355: require('lspconfig.server_configurations.gopls')
```
while the other servers take tens of millisecond.

After implementing this change, gopls takes about the same time as the
others:
```
033.563  000.163  000.163: require('lspconfig.server_configurations.gopls')
```

I have tried to replace `go env GOMODCACHE` with
`echo /home/cjoly/go/pkg/mod` but it’s just as slow. I suspect that the
call to `system()` is so slow because I use the fish shell. If I change
the 'shell' setting to 'sh', the issue disappears. Nonetheless, it’s
probably worth fixing, since this change is not very complex IMO, even
if my configuration is somewhat exotic.

I’ve checked that this change does not make using the 'sh' shell slower
and that the LSP still initializes properly.
@glepnir
Copy link
Member

glepnir commented Jun 14, 2023

if this command have performance issue can make it async in root_dir .

@glepnir
Copy link
Member

glepnir commented Jun 14, 2023

I have make it async in #2673 could you test it

@cljoly
Copy link
Author

cljoly commented Jun 17, 2023

Just seen your second comment, thank you!

Yes, your solution in #2673 does fix the issue as well.

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

Successfully merging this pull request may close these issues.

2 participants