cmd/go: 'list std' unnecessarily opens *_test.go files #31925
Labels
GoCommand
cmd/go
help wanted
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
ToolSpeed
Milestone
While working in an environment with a slow filesystem (immediate stats+readdirs, but slow opens), I noticed that
go list std
was very slow (~6 seconds), which prompted me to look at what it was doing.One thing that jumped out was that it's opening *_test.go files, which should not be necessary to answer the question of whether a directory in $GOROOT contains a Go package.
That's about 37% of the overall files opened:
Overall, we read 67 MB in from disk just to answer
go list std
:If I make os.Open panic on an
_test.go
open, I see a number of backtraces just by re-running it a few times:and
I tried to hide all the *_test.go files by altering the build context early in the list command,
... but there are several places that are concurrently pre-loading some data, making that not fully effective. (It helps a bit).
/cc @bcmills @jayconrod @rsc @ianlancetaylor
The text was updated successfully, but these errors were encountered: