x/tools/internal/gopathwalk: regression in module cache scan performance #65531
Labels
FixPending
Issues that have a fix which has not yet been reviewed or submitted.
NeedsFix
The path to resolution is known, but the work has not been done.
Tools
This label describes issues relating to any tools in the x/tools repository.
ToolSpeed
Milestone
As described in the discussion of https://go.dev/cl/508506, simplifying gopathwalk to use filepath.WalkDir had the unfortunate consequence of significantly slowing performance when starting from a cold module cache, as would be the case when running goimports from the command line. This is also very noticeable when gopls is initially started. On my laptop, with a 19GB module cache, warming up goimports went from ~6s to ~30s.
Because this latency was already a concern for gopls (see #44863), I don't think we can afford such a significant regression. With that said, the regression is probably possible to mitigate with alternative concurrency strategies. A benchmark is added in https://go.dev/cl/561436 which we can use for revisiting the simplification. For now, I think we need to temporarily revert CL 508506.
CC @bcmills
The text was updated successfully, but these errors were encountered: