My Windows app uses sourcekit-lsp. It processes requests from my app. There are not many requests, and if there is no input from the user in my app, there are no requests at all (I checked, my application is not at fault). Despite this, the sourcekit-lsp process constantly consumes ~24% of CPU power all the time, even when idle. What can cause this? What intensive calculations it does when nothing is requested from it?
I am using Swift 5.9.2. Just tried both Swift 5.10 Development and Trunk Development (main) which shows version number 5.11-something. Unfortunately the problem persists in both
Swift version CPU usage by sourcekit-lsp
5.6.1 0%
5.6.2 not tested
5.6.3 not tested
5.7 not tested
5.7.1 not tested
5.8 0%
5.8.1 0%
5.9 24%
5.9.1 not tested
5.9.2 24%
5.10 dev 24%
trunk dev 24%
It seems the bug was introduced in version 5.9 and is still not fixed in either Swift 5.10 Development or Trunk Development (main).
This is definitely interesting. I wonder if we can isolate this a bit further. I think that it might be possible to isolate libdispatch (though it is unlikely to be the cause as it doesn't change very much). I wonder if the issue is in SourceKit-LSP, sourcekitd, or somewhere else. Hopefully @z2oh might have some time to look into this.
Do you know if a corresponding issue with self-contained reproduction steps tracking this exists at Issues · apple/sourcekit-lsp · GitHub? If it doesn't, would you mind filing one?