x/tools/go/packages: high CPU usage while processing cgo file #32821
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
This issue is related with vscode-go#2598. While working on cgo project, both
gocode
andgopls
will use huge amount of CPU when making autocomplete suggestion. It can be seen here forgocode
and here forgopls
.After looking around, I found out the reason for this is because both
gocode
andgopls
usesLoadSyntax
mode, which makego/packages
rungo list
with-compiled
flag set to true, which lead to high CPU usage in cgo project.What did you expect to see?
The cgo file can be parsed as light as the normal Go code.
What did you see instead?
The process uses huge amount of CPU.
The text was updated successfully, but these errors were encountered: