x/tools/gopls: very slow startup without go.mod or go.work #56496
Labels
FrozenDueToAge
gopls/performance
Issues related to gopls performance (CPU, memory, etc).
gopls
Issues related to the Go language server, gopls.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
The command 'gopls semtok /tmp/a.go' takes 84 seconds when run in my home directory on my Mac. (a.go is short: 'package main; func main(){}') Most users would not see this problem because they would invoke gopls from an editor.
All the time is spent in findModules. It's called twice, once for findWorkspaceRoot (27.7 elapsed seconds) and once for newWorkspace (53.2 elapsed seconds). With a go.work file added, it instead finishes instantaneously. The file tree rooted at home directories tends to be large on Macs, because it include s./Library, which, for me, is 500,000 files.
The text was updated successfully, but these errors were encountered: