Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single file IntelliSense consumes massive CPU indexing all system includes #1109

Closed
MichaelGrupp opened this issue Oct 7, 2017 · 8 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service

Comments

@MichaelGrupp
Copy link

MichaelGrupp commented Oct 7, 2017

Hi guys,

I experience a high CPU load, apparently caused by the C++ extension. One core is always used 100% even when no files are being edited. The problem doesn't occur with code --disable-extensions. My issue looks similar to this one: microsoft/vscode#33176

Here's my configuration:

  • VSCode Version: Code 1.17.0 (be377c0faf7574a59f84940f593a6849f12e4de7, 2017-10-04T23:33:45.303Z)
  • OS Version: Linux x64 4.4.0-96-generic
  • Extensions:
Extension Author (truncated) Version
gc-excelviewer Gra 1.1.15
code-settings-sync Sha 2.8.3
githistory don 0.2.3
python don 0.7.0
gitlens eam 5.4.1
LogFileHighlighter emi 1.2.0
terminal for 0.0.10
vscode-auto-open-markdown-preview hnw 0.0.4
cpptools ms- 0.13.1
platformio-ide pla 0.7.3
shebang-snippets rpi 0.0.3
bash-beautify sha 0.1.1
rst-vscode tht 2.0.0
cmake twx 0.0.17
cmake-tools vec 0.10.2
gitblame wad 2.2.0
debug web 0.21.2

Steps to Reproduce:

  1. open vscode with C++ extension
  2. do nothing, the CPU load is always high

Reproduces without extensions: No

@MichaelGrupp
Copy link
Author

vscode_cpp_cpu

@Irvel
Copy link

Irvel commented Oct 8, 2017

I'm experiencing the exact same issue in macOS.

  • VSCode Version 1.17.0 (1.17.0) (be377c0faf7574a59f84940f593a6849f12e4de7, 2017-10-05T06:03:48.991Z)

  • macOS 10.13

  • Microsoft C/C++ for VSCode Version 0.13.1

screen shot 2017-10-08 at 10 04 13 am

@sean-mcmanus
Copy link
Collaborator

What are your c_cpp_properties.json settings? Depending on your browse settings, this might be "by design". You can enable logging to see if there's unexpected work occurring: https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/Enabling%20logging.md .

@sean-mcmanus sean-mcmanus added Language Service more info needed The issue report is not actionable in its current state labels Oct 9, 2017
@bobbrow
Copy link
Member

bobbrow commented Oct 9, 2017

An hour and a half of parsing seems too much, even for large projects. Can you give us more information about the project? How many files? Is it open source so we can try to debug the problem locally? As Sean mentions, the "browse.path" setting may have an impact because we will recursively scan folders, so try not to include the same subfolders multiple times until we add support to prune rescans.

@MichaelGrupp
Copy link
Author

MichaelGrupp commented Oct 9, 2017

ahh, interesting hint. When I experienced this, I had no folder selected (just opened a single file for quick editing).

I just opened a random folder and the problem disappeared. It seems to re-appear when the folder is closed with ctrl + kf. As mentioned, this happens without opened files, too.

Here are some logs generated with the env. variables from the link of @sean-mcmanus posted above at loglevel 5.

Looking at the logs it seems like the recursion runs amok when there's no folder selected? 🤔

@bobbrow
Copy link
Member

bobbrow commented Oct 9, 2017

Thank you for the logs. That was super helpful. It looks like VS Code is not sending us a root path when you open a single file and we end up treating all of the system includes as part of your "workspace" which means that we won't skip parsing them.

add folder to browse.path: /usr/include/c++/5.4.0
add folder to browse.path: /usr/include/x86_64-linux-gnu/c++/5.4.0
add folder to browse.path: /usr/local/include
add folder to browse.path: /usr/lib/clang/3.8.0/include
add folder to browse.path: /usr/include
add folder to browse.path: /usr/include/x86_64-linux-gnu
add folder to browse.path:      <--  empty path

@bobbrow bobbrow changed the title CPU load constantly high Single file IntelliSense consumes massive CPU indexing all system includes Oct 9, 2017
@bobbrow bobbrow added bug and removed more info needed The issue report is not actionable in its current state labels Oct 9, 2017
@MichaelGrupp
Copy link
Author

Glad to help, hope you get this fixed soon. The workaround until then is just to open a folder 😉

@bobbrow bobbrow added the fixed Check the Milestone for the release in which the fix is or will be available. label Oct 10, 2017
@bobbrow
Copy link
Member

bobbrow commented Oct 19, 2017

We released 0.14.0 with a fix for this. Please let us know if you continue to have issues.

@bobbrow bobbrow closed this as completed Oct 19, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

4 participants