Open dbstd2333 opened 1 year ago
Hi, gopls does use a lot of CPU. We're working on fixing that, but without more info about your particular use-case, I'm not sure this issue is actionable.
Can you share approximately how large your workspace is, in terms of number of files?
that's all,just a mini proj :(
Are you seeing persistent CPU usage, or just at startup? When gopls starts, it type-checks the workspace (which may involve type-checking dependencies, and can be expensive if there are a lot of large dependencies). But eventually it should stabilize and not use that much CPU.
Whenever I press ctrl+s, CPU usage becomes 100% And last 2 s , you can watch the video https://github.com/golang/vscode-go/files/10474450/2023-01-22.20-48-33.zip
Are you able to capture extension logs? https://github.com/golang/vscode-go/blob/master/docs/troubleshooting.md#collect-extension-logs
That would tell us what gopls is doing. (note: these logs can contain source code, so be careful if you don't want to share file content)
Are you able to capture extension logs? https://github.com/golang/vscode-go/blob/master/docs/troubleshooting.md#collect-extension-logs
That would tell us what gopls is doing. (note: these logs can contain source code, so be careful if you don't want to share file content)
sorry i cant find the options , my vscode inside is chinese and the view output js grey
Sorry, it's going to be very difficult for us to diagnose without more info.
I can try to take a look at your CPU profile -- how did you collect it?
golang/go#57987 is our medium-term project to drastically improve performance.
Sorry, it's going to be very difficult for us to diagnose without more info.
I can try to take a look at your CPU profile -- how did you collect it?
golang/go#57987 is our medium-term project to drastically improve performance.
i use the devtools to collect it when i coding the go
Sorry, it's going to be very difficult for us to diagnose without more info.
I can try to take a look at your CPU profile -- how did you collect it?
golang/go#57987 is our medium-term project to drastically improve performance.
i check my taskmanager , infact the gopls.exe CPU usage is not very high , almost 15% , the vscode‘s’ all process cpu usage is 30% or so , but the system.exe is 30+% , the total cpu usage is 100% , my computer‘s cpu is i7-8750h 6c12t 3.9ghz 16gmem
Oh that's interesting context, thank you. We'll discuss this in our triage meeting.
Do you have any other extensions active that could cause this?
no,just use vetur and dart/flutter and go
Unfortunately the attached CPU profile shows only the VS Code workbench side samples (not the shared process where this extension code is running). I see a lot of executeCommand
calls, so I have wild guess but extension profile will be helpful before making any conclusion.
@dbstd2333 Can you try to collect the extension profile following https://github.com/microsoft/vscode/wiki/Performance-Issues#profile-the-running-extensions? And try "Developer: Open Process Explorer" - that will show what sub processes of vscode are consuming cpu/memory.
I get very high CPU usage whenever I save from the linting tools I have configured to run. @dbstd2333 is it possible you're seeing the same thing?
I just want an IDE that works., and doesn't get in the way of my programming by creating artificial constraints and making my laptop super hot from high CPU usage, as I'm only typing text.
From my perspective, I'm just using a fancy version of notepad, and there is no reason for a single EXE that I consider optional and only needed every 30 seconds or so to be called on every single thing I type. That's just insane.
Please, the integration with GOPLS needs to change, so it's not as CPU heavy. It's simply called too often by Visual Studio Code when it should not be, its not caching files that do not change in memory enough, its doing too much disk IO Unnecessarily and wastefully, and its become an actively harmful thing to the Go community; I'm sick of losing laptops because they overheat due to this issue. This bad code is killing hardware, PLEASE FIX IT.
@duaneking please keep in mind the Go code of conduct in your communication. We don't want you to have a poor user experience, and work with our limited resources to address the most important problems or missing features our users encounter with gopls and the VS Code plugin.
For example, gopls@v0.12.0 significantly reduced gopls' memory footprint, which was a major pain point for many users. That change required a redesign of gopls' core operations. We aimed to achieve similar performance with a fraction of the memory, and for the most part achieved that goal. However, there are certain areas where we may have regressed, and we have been fixing these regressions as we discover them; many are edge cases related to the new analysis driver which for the first time fully analyzes dependencies (for example golang/go#61178).
Additionally, I think there are opportunities to reduce CPU across the board while typing. I'm working on this now in golang/go#60926.
If you're having specific problems, the best way to help us fix them is by helping us investigate: how large is your workspace? Can you share the output of gopls stats -anon
? Did you experience these problems with gopls@v0.11.0
, or just gopls@v0.12.x
? What exactly do you observe? Would you be willing to capture a CPU profile while you're typing?
Alternatively, you can disable language server integration entirely with the "go.useLanguageServer"
setting.
Macbook pro m1 When i turn on vscode go plugin i have 400% of usage cpu Cpu have over 1000C temperature. Will u fix this problem?
@Zrossiz how long does it take for the CPU to settle to 0%? The first time you use gopls on a workspace, it must do a significant amount of indexing.
@findleyr its allways 400% usage of cpu. It doesn't get any less with time.
@findleyr i have this problem like 2 days. Before this plugin working normally
I want add that I also notice high CPU usage for this plugin. Im running mine on linux wayland. Process explorer does not show anything golang plugin related. When I open KDE activity monitor, the CPU is pegged. After I removed the golang plugin from VS Code the CPU went back to normal.
I have a very small test/ sample project that has basically one dependency.
I get very high CPU usage whenever I save from the linting tools I have configured to run. @dbstd2333 is it possible you're seeing the same thing?
yes,but recently i haven't code much go,and i change a new laptop
its allways 400% usage of cpu. It doesn't get any less with time.
When gopls has been running for more than, say, 1m and is still using a lot of CPU, could you run killall -QUIT gopls
to terminate the program dumping all goroutine stacks, and post the resulting trace (which you can find in VS Code's Output window under "gopls (server)"). This will give us at least one data point about what gopls is using the CPU for.
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
* Run `go version` to get version of Go from _the VS Code integrated terminal_. - go version go1.19.5 windows/amd64 * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. - Build info ---------- golang.org/x/tools/gopls v0.11.0 golang.org/x/tools/gopls@v0.11.0 h1:/nvKHdTtePQmrv9XN3gIUN9MOdUrKzO/dcqgbG6x8EY= github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= github.com/google/go-cmp@v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= golang.org/x/exp@v0.0.0-20221031165847-c99f073a8326 h1:QfTh0HpN6hlw6D3vu8DAwC8pBIwikq0AI1evdm+FksE= golang.org/x/exp/typeparams@v0.0.0-20221031165847-c99f073a8326 h1:fl8k2zg28yA23264d82M4dp+YlJ3ngDcpuB1bewkQi4= golang.org/x/mod@v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= golang.org/x/sync@v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sys@v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= golang.org/x/text@v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= golang.org/x/tools@v0.3.1-0.20221213193459-ca17b2c27ca8 h1:7/HkGkN/2ktghBCSRRgp31wAww4syfsW52tj7yirjWk= golang.org/x/vuln@v0.0.0-20221109205719-3af8368ee4fe h1:qptQiQwEpETwDiz85LKtChqif9xhVkAm8Nhxs0xnTww= honnef.co/go/tools@v0.3.3 h1:oDx7VAwstgpYpb3wv0oxiZlxY+foCpRAwY7Vk6XpAgA= mvdan.cc/gofumpt@v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= mvdan.cc/xurls/v2@v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc= go: go1.19.1 * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - 1.75.0-insider 9ccc2b3b30c122afe45bc6722bef0e3901fb2806 x64 * Check your installed extensions to get the version of the VS Code Go extension -
Share the Go related settings you have added/edited
i have no "setting
Describe the bug
when i use vscode go plugin my computer's cpu usage will Intermittent high,please unzip and watch the video 2023-01-22 20-48-33.zip
please unzip the zip to get the cpuprofile CPU-20230122T203309.cpuprofile.zip