-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
Relatively high cpu utilization when idle #329
Comments
Set |
Is it possible to make -1 be safe default for |
Interesting, it did not work for me. |
What is 10% mean in your manager? If this is the first case, it shows that the extension is not really idle, and the common situation is that it is carrying out workspace diagnosis. You can adjust the delay and running rate of workspace diagnostics by setting, or disable this feature directly. If this is the second case, it shows that |
X% in Activity Monitor means X% of one virtual core. I have an Intel i7 with 4 cores, with hyper threading, so the percentage can go up to 800%.
But why do we need this? Can't this language server only act once it receives a message on the |
If you deleted a global variable definition in one file, it will check if other files are still using this global variable. |
Sure, but this check is only required once you receive a |
Yes, however, sometimes it will take more time to complete the diagnosis, depending on the number and size of your files. |
It seems |
Add workspaceDelay LuaLS/lua-language-server#329 (comment)
I have just tried to lower https://github.com/sumneko/lua-language-server/blob//script/service/service.lua#L152 to |
Please also try |
With
idle cpu usage goes down to 0.2%. |
how about |
1.7% |
I changed it to 0.01 seconds. On my own computer test, there is almost no difference between 0.001 and 0.01, but 0.1 will have a significant sense of delay. |
Could you please help me to do another test? |
Absolutely, but it still gives me 1.7% on idle. |
Thank you! |
b57cd42 drops CPU usage to 0.5% while idling. Huge improvement! |
I still think you should remove the sleep loops entirely and rely only on events from the client. That will guarantee you 0% idle cpu usage. |
This is difficult to achieve.
|
Done |
Yep, CPU utilization looks much better now. Apologies for not responding earlier. I've updated my sublime package to download 1.19.0 of the server sublimelsp/LSP-lua@a522abf |
Describe the bug
This server uses about 10% of my CPU when doing nothing.
To Reproduce
./bin/macOS/lua-language-server -E -e LANG=\"EN-us\" main.lua
Expected behavior
0% CPU utilization when idle.
Screenshots

Environment (please complete the following information):
Additional context
I'm guessing this is due to a timer busy-looping in script/service/service.lua:
But it's only speculation at this point.
The text was updated successfully, but these errors were encountered: