Closed edjiang closed 2 years ago
It's hard to tell. There is a guide for the profiling.
I had 100% CPU issue few weeks ago. The reason is that the project folder contains too many files, but I don't think it's your case.
Ah, that makes sense. I work at Uber and we have a large iOS monorepo and so I use VS code to browse through code instead of opening up the projects through Xcode. You can imagine it's probably the definition of "too many files" :)
Thanks!
@edjiang thanks for the report!
Did you pick sourcekit-lsp
or sourcekite
as driver (both might behave differently regarding performance)?
Does anyone of you @edjiang and @haifengkao know a huge open source Swift project where I might be able to reproduce this issue?
I was probably using sourcekite - as I said I didn't read the docs closely so clicked install and started using it.
I'm not sure if there's a large open source project on our size (since it's a monorepo, it has all of the apps + dependencies, and we write swift fairly verbosely), but I know when our team is looks at build tooling issues we may generate dummy code to help profile. So that'll probably be more effective for you than looking for an existing project.
Sadly I haven't found enough time to tackle this issue the last month and I am unsure when I have enough time.
Naively duplicating the same fileprivate struct HelloWorld { var text = "Hello World" }
didn't lead to a quick solution. Especially as I think I rarely experienced the same behavior in smaller projects.
If there are others experiencing this or with new information, please let me know.
+1
First go to activity monitor to find the PID of the code Helper, then in terminal (replace 51785 with your PID)
ps aux | grep 51785
you will see
51785 98.7 0.4 42423476 60756 ?? R 11:29AM 1:31.34 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Renderer).app/Contents/MacOS/Code Helper (Renderer) --ms-enable-electron-run-as-node --nolazy --inspect=6004 /Users/jfang1/.vscode/extensions/vknabel.vscode-swift-development-environment-2.12.2/out/sourcekites-server/server.js --node-ipc --clientProcessId=18334
Uninstalling for now so that my Mac will keep running its fun whole day long.
Hey, does the same behavior happen when using the official Swift extension? See #40
When using this extension, the extension's NodeJS server pins my CPU at 100%, and the process stays even after killing VS Code. I didn't read the documentation carefully and downloaded this just for syntax highlighting, so I didn't set up a language server. Could that have been why?
I realize now that this is for running Swift and overkill for my needs, so I've switched extensions and things are fine. However I used this extension for a while so really appreciate your effort working on it -- lmk if can help debug at all!