x/tools/gopls: vet the DegradedClosed memory mode and move out of experimental #46902
https://golang.org/cl/330529 fixed loading of std and cmd, resulting in better features for std and cmd but worse resource usage.
The text was updated successfully, but these errors were encountered:
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 <firstname.lastname@example.org> Run-TryBot: Robert Findley <email@example.com> gopls-CI: kokoro <firstname.lastname@example.org> TryBot-Result: Go Bot <email@example.com> Reviewed-by: Rebecca Stambler <firstname.lastname@example.org>
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 <email@example.com> Run-TryBot: Robert Findley <firstname.lastname@example.org> gopls-CI: kokoro <email@example.com> TryBot-Result: Go Bot <firstname.lastname@example.org> Reviewed-by: Rebecca Stambler <email@example.com>