Open namniav opened 1 month ago
I can't reproduce.
From the logs I can see that YCM is making the expected (small) number of server message polls
YCM has a few timers that fire every ~100ms in normal mode and ~10ms in insert mode, but these callbacks are very light.
Do we know it's vim/ycmd? Considering clangd
in the debug info, I bet this is just clangd indexing a big repo which is resuling in a long high cpu load.
For LLVM I needed a few hours for clangd to index everything. After that, it was smooth sailing.
@puremourning Thank you for investigating the issue.
Did you start vim with -O
option to open windows side by side for each file? I noticed that more vim windows(splits) for C++ files, higher constant cpu usage taken by Terminal. Without -O
it's about 14% on my side.
I can reproduce the issue stably, is there something else I could try and provide?
Do we know it's vim/ycmd? Considering clangd in the debug info, I bet this is just clangd indexing a big repo which is resuling in a long high cpu load.
No, it's not vim/ycmd/clangd process, but only Terminal taking constant high cpu usage. It's reproducible in any empty directory on my side.
I just restarted macOS and it's lower but still unexpectedly high. It's about 19% with -O
and 7.x% without -O
.
In directory /tmp
:
YCM + CPP + -O
: vim -Nu ~/.vim/plugged/YouCompleteMe/vimrc_ycm_minimal test1.cpp test2.cpp test3.cpp -O
YCM + CPP: vim -Nu ~/.vim/plugged/YouCompleteMe/vimrc_ycm_minimal test1.cpp test2.cpp test3.cpp
YCM + PY + -O
: vim -Nu ~/.vim/plugged/YouCompleteMe/vimrc_ycm_minimal test1.py test2.py test3.py -O
noYCM + CPP + -O
: vim -Nu NONE test1.cpp test2.cpp test3.cpp -O
Edit: The columns of ActivityMonitor are same as your screenshot above: Process Name | %CPU | CPU Time | Threads | Idle Wake-Ups | Kind | %GPU
Issue Prelude
Please complete these steps and check these boxes (by putting an
x
inside the brackets) before filing your issue:vim --version
.:YcmDebugInfo
.:YcmToggleLogs
command.vim -Nu /path/to/YCM/vimrc_ycm_minimal
, including what I expected to happen and what actually happened.install.py
(orcmake
/make
/ninja
) including its invocationThank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.
Issue Details
On M1 Macbook Air, the Terminal app, not the vim process, has constant high CPU usage for each opened C++ file, including new files that don't exist.
With 3 new empty C++ files opened, the Terminal app takes 30+% CPU usage constantly, even when there's no input/action to vim. Currently I only found this problem with C++ files and with YCM enabled. The problem disappears if no C++ file is opened(e.g. only
.py
files) with YCM enabled, or C++ files are opened with disabled YCM, both takes 0.0% CPU usage.With actual C++ files with complicated source code opened, even higher CPU usage is taken for each file and heats the computer constantly.
vim -Nu vimrc_ycm_minimal test1.cpp test2.cpp test3.cpp -O
, no.cpp
files have to exist.No change is made.
What did you expect to happen? Don't take high CPU usage when idle.
What actually happened? Terminal app takes high CPU usage constantly.
Diagnostic data
Output of
vim --version
Output of
YcmDebugInfo
Output of
YcmDiags
Output of
git rev-parse HEAD
in YouCompleteMe installation directoryContents of YCM, ycmd and completion engine logfiles
OS version, distribution, etc.
M1 Macbook Air, macOS 14.1 (23B74)