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

x/tools/gopls: vet the DegradedClosed memory mode and move out of experimental #46902

Open
findleyr opened this issue Jun 24, 2021 · 2 comments
Open

Comments

@findleyr
Copy link
Contributor

@findleyr findleyr commented Jun 24, 2021

https://golang.org/cl/330529 fixed loading of std and cmd, resulting in better features for std and cmd but worse resource usage.

"memoryMode": "DegradedClosed" should per my recollection revert us to the old model, but it seems not to work. We should fix this. More generally, I think the degraded memory model could be useful for many users, and we should vet it and move it out of experimental.

CC @stamblerre

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 9, 2021

Change https://golang.org/cl/333689 mentions this issue: internal/lsp: improve package search in a couple places

gopherbot pushed a commit to golang/tools that referenced this issue Jul 13, 2021
When we open a file in a package, independent of whether it is in the
workspace, we type check in ParseFull mode. However, several other
code paths don't find this better parse mode.

We need a better abstraction, but for now improve a couple code paths
specifically for the purpose of fixing Hover content.

Updates golang/go#46158
Updates golang/go#46902

Change-Id: I34c0432fdba406d569ea963ab4366336068767a2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/333689
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 21, 2021

Change https://golang.org/cl/336410 mentions this issue: internal/lsp: in degraded mode, limit the workspace to active packages

@stamblerre stamblerre removed this from the gopls/v0.7.1 milestone Jul 26, 2021
@stamblerre stamblerre added this to the gopls/v0.7.2 milestone Jul 26, 2021
gopherbot pushed a commit to golang/tools that referenced this issue Jul 26, 2021
In my testing, the gopls degraded memory mode (currently set via
"memoryMode": "DegradeClosed") did not save as much memory as expected
due to still type checking all packages in the workspace (even if in
ParseExported mode). It is also annoying to get incomplete results from
references and renaming.

I think we can (and should) fix both problems: don't even consider
packages that aren't 'reachable' via open files, but fully type check
the reverse transitive closure of the packages you're working on. This
CL does exactly that, by swapping out the concept of 'workspace
packages' with 'active packages'.

In testing, this decreased my memory footprint while working on std by
3-4x when compared to normal mode, and 2x when compared to the previous
implementation of DegradeClosed.

It still needs more testing before we move this option out of
experimental.

For golang/go#46902

Change-Id: I1e319d0b1607d344d27e797ce32de057d7a583f9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/336410
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@stamblerre stamblerre removed this from the gopls/v0.7.2 milestone Sep 9, 2021
@stamblerre stamblerre added this to the gopls/on-deck milestone Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants