]> Cypherpunks repositories - gostls13.git/commit
internal/testenv: avoid rebuilding all of std in WriteImportcfg
authorBryan C. Mills <bcmills@google.com>
Thu, 2 Feb 2023 15:42:46 +0000 (10:42 -0500)
committerGopher Robot <gobot@golang.org>
Thu, 2 Feb 2023 19:27:33 +0000 (19:27 +0000)
commit4b43d668c2ae42465af7cbad4bc5fa86d0b6cc15
treecc68055be7392a361312de837006dc8cbeb56c54
parent18772915a1b9ca211a4bb707de59ee0941b4773b
internal/testenv: avoid rebuilding all of std in WriteImportcfg

Instead, have the caller pass in an explicit list of the packages
(if any) they need.

After #47257, a builder running a test does not necessarily have the
entire standard library already cached, especially when running tests
in sharded mode. testenv.WriteImportcfg used to write an importcfg for
the entire standard library — which required rebuilding the entire
standard library — even though most tests need only a tiny subset.

This reduces the time to test internal/abi with a cold build cache on
my workstation from ~16s to ~0.05s.

It somewhat increases the time for 'go test go/internal/gcimporter'
with a cold cache, from ~43s to ~54s, presumably due to decreased
parallelism in rebuilding the standard library and increased overhead
in re-resolving the import map. However, 'go test -short' running time
remains stable (~5.5s before and after).

Fixes #58248.

Change-Id: I9be6b61ae6e28b75b53af85207c281bb93b9346f
Reviewed-on: https://go-review.googlesource.com/c/go/+/464736
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
src/cmd/internal/archive/archive_test.go
src/cmd/link/link_test.go
src/cmd/objdump/objdump_test.go
src/cmd/pack/pack_test.go
src/go/internal/gcimporter/gcimporter_test.go
src/internal/abi/abi_test.go
src/internal/goroot/importcfg.go [deleted file]
src/internal/testenv/testenv.go