diff options
| author | Pierre Gimalac <pierre.gimalac@datadoghq.com> | 2026-03-02 01:34:33 +0100 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-04-13 15:22:24 -0700 |
| commit | 524bd85dfd9c2c9fac263a2806e17cedb3cea85c (patch) | |
| tree | e06d2d5a17edcf13bd9be57afa9a056afc5fa442 /src/os/exec | |
| parent | 3d4ee07f7f1c6c4870677d9530e1c4bdef2c5e0a (diff) | |
| download | go-524bd85dfd9c2c9fac263a2806e17cedb3cea85c.tar.xz | |
cmd/go: avoid redundant work in go work sync
First, updateWorkspaceRoots creates a new Requirements to update the
direct map, but always with an empty graph cache, discarding the cached
module graph. Since workspace roots do not change during package
loading, the graph is identical each time; propagate the cached graph to
the new Requirements to avoid rebuilding it from scratch on each call to
Graph.
Second, checkMultiplePaths iterates the full build list on every
loadFromRoots call. Its result depends only on the build list and
workspace replace directives, both fixed for the lifetime of the module
graph. Updated the code to only run once per graph.
Together these reduce go work sync time on a workspace with 184 modules
from ~35s to ~8.5s.
Fixes #77889
Change-Id: I7276aed3109424b3b74a4064b369ed7cbfca7735
Reviewed-on: https://go-review.googlesource.com/c/go/+/750500
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Bypass: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'src/os/exec')
0 files changed, 0 insertions, 0 deletions
