-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Restrict background analysis scope to reduce CPU consumption in live analysis #38429
Comments
Ideally the trigger for this mode would be provided by the core editor or platform, and Roslyn would simply respond to it. |
tagging @kendrahavens @jinujoseph looks like we are getting vote already. |
Design review outcome
|
I suggest making this not just an event, to which components (like Roslyn) might react to, but include a mechanism for components supporting the mode to register themselves with, so there could be implemented some form of dialog, that lets you choose, which component to disable/power down when entering power safe mode. |
This PR adds support for ability to control analyzer execution (IDE code style analyzers and third party analyzers) and execution of service that searches NuGet packages and framework references to enable suggesting usings for types from them. We plan to add more options in future to allow users to control more functionality. Addresses dotnet#38429
1. Option to enable power save mode: Fixes dotnet#38429. This option turns off all the background analysis and also turns off remote host (RoslynCodeAnalysis service hub process) for C# and VB projects to reduce memory consumption in this mode. This option turns off most of the background analyses that are executed by the solution crawler. We still execute the bare minimum analysis for a reasonable editing experience: compiler analyzer to get compiler warnings/errors and also execute the add usings and remove unncessary usings analyzers. We can tune this required analysis set in future, as required. 2. Option to disable live analyzer execution: There have been lot of requests in past to give users a single knob to turn on/off execution of all Roslyn analyzers in the IDE (third party analyzers + IDE code style analyzers which are enabled by default). I have also hooked up the low virtual memory listener which detects low VM and used to turn off just the full solution analysis to now instead turn on a forced power save mode for the current VS session (which also turns off full solution analysis, along with other background analyses).
asked in DC |
I'm very wary about thsi. People are reporting slowness, and they're claiming it's due to a specified feature, but it's not clear to me how we're verifying what the actual root cause is. Code-analysis, for example, should not impact typing unless somethng has broken internally. It's run out of process and at low-priority. If it actually is slowing things down, then something is very messed up and needs to be fixed. |
I haven't looked at those reports but I expect some people want to disable roslyn just to use another analysis tool. |
I feel this feature is being looked at the wrong way in multiple ways. The core feature is:
IMO at the core, any tool with rich functionality has a much bigger value add if it configurable by the users to run as they want when they want. We should continue delivering productivity value add and never ever use these knobs as a way to de-prioritize bugs and regressions in configurable features - they are part of default experience for the tool and ought to be prioritized and fixed. Yes, there is possibility that some users would be less keen on providing reports or additional data to help us fix these if they can easily workaround it, and that makes fixing these harder for us, but that should never undermine the huge productivity boost that majority of customers get from the ability to take better control over its execution to meet their current requirements. |
I also feel this should be implemented as multiple operational modes:
We should explicitly document what each mode enables or disables to allow users to make informed choices. |
@mavasani I'm firmly behind the idea of different modes (or feature knobs) to provide a fundamentally different experience for users. I have no issue with that. What i'm concerned about are links to unverified claims by people that "feature X is awful and making my experience slow, give me a way to shut it off". These are not valid claims in support of this work without actual verification and validation that the claims are true. |
Please we need and option to turn off live code analysis, so
Most professional shops now days are using laptops with cpu power management, you need to make sure the teams making these great tools are using hardware kit akin to the target audience please! I don’t want to move of VS, but I’m scratching my head, whilst making a cupa tea waiting for my ide to become responsive :(. |
Note: Live Code Analysis shouldn't be affecting IDE responsiveness. If it is, that's just a straight up bug. Often times i've seen people report VS slowness against Roslyn when it's not roslyn at all (or at least, not live-code-analysis that is the problem). If you are dealing with VS responsiveness issues, please file bugs using the instructions found here: https://github.com/dotnet/roslyn/wiki/Reporting-Visual-Studio-crashes-and-performance-issues#performance-issues This will help get a perf trace to the Roslyn team so they can investigate and assign to the right team as appropriate (or keep in Roslyn if it really is a roslyn issue). Thanks! |
FWIW, i use a dual core laptop, and i edit the Roslyn project itself without issues. Occasionally there are regressions that cause problems, and i try to file these issues myself to get them addressed. However, by and large, VS/Roslyn should work fine in these scenarios. If it isn't, then those are just perf problems that need to be root-cause fixed. Adding new features won't generally help here. |
Replaces the existing "Full Solution Analysis" option, with a background analysis scope to allow users to control the analysis scope for all solution crawler based background analysis. Fixes dotnet#38429. Active file scope minimizes all the background analysis to the active files, saving on CPU consumption from background analysis on remaining files in the solution. I have also updated up the low virtual memory listener which detects low VM and used to turn off just the full solution analysis to now set the background analysis scope to "Active file" for the current session.
UpdateThis feature requested has been implemented for VS2019 16.5 release. Let me summarize a few things here for clarity. What is "Live Code Analysis" for Managed projects?Visual Studio executes a bunch of background analyses while you are editing source files in the editor. Some of this is required minimal analysis for acceptable IDE editing experience, some of this is to improve responsiveness for IDE features by proactively analyzing closed files in the solution and some of this is to enable additional rich functionality (such as IDE code style suggestions). Based on the functionality, the analyses can be bucketed as follows:
Feature requests
Support added in VS2019 16.5
Combining the above features, users can choose any of their preferred code analysis workflows for analyzer execution OR configure scope for all the Roslyn based background analysis. We will ensure that the above support is documented when VS2019 16.5 is released. We will look forward to any further feedback on code analysis configuration support once these features are available. |
Have you considered allowing the radio button selection to depend on the active Windows power profile (high performance, on battery, etc.)? Was this discarded because of UI complexity? |
This was indeed suggested and considered, but I did not get to implementing it in the initial feature set. Feel free to file a separate issue. |
@mavasani , should the "Background analysis scope" option be available in version 16.5.0 Preview 1.0? I just installed this version, but the option doesn't seem to be there |
@dennis-yemelyanov It will be available in Preview 2 |
Reopening this issue. "Power save" mode is a feature where implicit background operations in the IDE are converted to explicit operations that execute when a user requests them. Currently there is no UI design for exposing the request to explicitly trigger pending updates. |
This issue has been updated to more specifically target reduced background analysis scopes. A new issue for the broader Power Save feature has been opened here: |
we have been adding more and more features to IDE. it is long-tail features so it always helps some portion of our users. but there is also another portion of users who don't care that features or want to reduce noise or reduce system resource consumed from those features that they don't use much.
these people have been asking a way to disable those features altogether. and let those features only run when it is explicitly asked.
basically no solution crawler running, no background compilation running and etc.
it requires design meeting, but similar to power save mode other IDE team provides for exactly same reason.
The text was updated successfully, but these errors were encountered: