-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal/lsp/cache: hold on to imports used by open packages
Benchmarking demonstrated clearly that gopls must memoize active packages, to efficiently handle repeated requests related to open files (e.g. code lens, completion, semantic tokens). In doing so, gopls is effectively pinning the import graph of these open packages. However, when those packages changed, this import graph was not being reused. Furthermore when multiple open packages shared packages in their import graph, there was a chance that gopls may pin multiple copies of those packages, if the open packages were type-checked in separate batches. This change introduces a new optimization which manages a shared import graph to be re-used across snapshots. Before performing any type-checking we re-evaluate this shared import graph. This is purely an optimization, and is not necessary for correctness. As such, the feature is guarded behind a compile-time constant, so that it may easily be disabled for debugging. The plan is to have several such constants. For golang/go#57987 Change-Id: Ica654ffc8f1e5f39bcab7000c0839ece22e20ab2 Reviewed-on: https://go-review.googlesource.com/c/tools/+/479015 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Alan Donovan <[email protected]> gopls-CI: kokoro <[email protected]> Run-TryBot: Robert Findley <[email protected]>
- Loading branch information
Showing
10 changed files
with
313 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.