This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm submitting this since I had it sitting around. Let me know what you think.
This was suggested in #479. Doing this lowers the priority of the process to "below normal", which on UNIX-y systems is implemented as nice level 10. It may help yield CPU time to other things on the system if the analyzer is stuck somewhere using 100% of a core.
I checked the Roslyn analyzer after noticing it was set to below normal priority in my process list (see here), hence this PR. They additionally have the notion of a "user operation booster", which temporarily brings the process back to the normal priority, then back down again when disposed. Unfortunately, I don't believe this would work cross platform, as on UNIX-y systems users are not allowed to lower a nice value after increasing it without being
root
, even with processes they own, even to values that had previously been set.I don't really like having to put this in
Program.cs
, as it'd be better served to be set afterInitialize
has occurred (and have it configurable), but that'd deprioritize the process during unit tests which I don't think is desirable. Perhaps enabling it when in release mode only would be a better choice.A downside in general is that the CPU usage problem is going to be gone anyway as the old analysis that gets stuck won't exist. This would be a short-lived patch (which may or may not end up helping in the meantime).