Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal/cache: use packageHandles to hold an active package cache
Previously, gopls was keeping a common import graph up to date between snapshots, to optimize re-typechecking open packages. However, this had several downsides: - It required rather complicated accounting - Working in package A could get slower after opening package B, if package B was in the forward closure of A, since it reduced the common import graph. - Since imports were constructed a-priori to type checking, we imported *all* packages in the forward closure of open packages, even if they wouldn't be needed for type checking, inflating the memory footprint. This CL changes gopls to instead keep track of the active package on the packageHandle, and invalidate its imports independently of other active packages. As a result, we can eliminate the complicated importGraph logic and the associated relationships between open packages. We also reduce memory by holding on to a minimal set of imports for open packages. Change-Id: I82c49bb7002ab748497f34b43844b34176bdef9c Reviewed-on: https://go-review.googlesource.com/c/tools/+/614165 Auto-Submit: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
- Loading branch information