How to improve Visual Studio 2022 performance

Tuning big Visual Studio performance for cloud projects

Stas(Stanislav) Lebedenko
Microsoft Azure
4 min readMar 5, 2024

--

TL;DR; This article is about the configuration setting of Visual Studio 2022 that can affect your experience during development of your cloud C# projects. So, you can try all possible measures before asking for a new laptop or VM configuration update.

Plan

We are all experienced developers, but sometimes it is hard to see the bigger picture, so here are a few settings to check and find out what can be the root cause of slow performance or even freezes.

  • Disabling background code analysis
  • Switching off branch history
  • Disabling hardware acceleration
  • Switching your monitor to 60Hz
  • Gradually disabling IntelliSense as a last resort
  • Before you ask for the hardware
  • Custom metrics on your PC/VM

Disabling background code analysis

Background code analysis can cause slow performance, so let’s start here with settings for C#. Please use the different language sections to adjust the code analysis for your case.

Switching off branch history

If you have a huge solution and long loading times, this setting is for you. First, try to turn off Git Repository’s multiple-branch history. If this does not help, try to experiment with Load projects faster because sometimes it works the other way around.

Disabling hardware acceleration

Hardware acceleration and overall Auto adjustment can hurt certain types of restricted laptops and virtual machines, both cloud and Hyper-v-based. So here are settings to experiment with.

Switching your monitor to 60Hz

Yes, once upon a time, there was a performance problem with Visual Studio related to the refresh rate of your monitor, and while it was fixed, there is a chance that you are missing this update or it was re-introduced again.

Gradually disabling IntelliSense as a last resort

If nothing helps, then there is one more thing to try: by gradually turning off IntelliSense options, you can try to pinpoint performance problems. Is it related to Visual Studio 2022? Or is it time to make a call for a new laptop?

Before you ask for the hardware

Asking for the new hardware is the easiest option and can save time and money. But we are engineers, so here are a few things to do before.

  • Collect sample networking telemetry for a few hours of your working day and check if there are any severe lags. This can be done with WireShark or Netsh tool in Windows. https://blog.kaniski.eu/2021/04/capturing-network-trace-in-windows/
  • Try JetBrains Rider with your solution; you can have a 1-month trial.
  • Identify a baseline performance that you might need from new hardware with the help of geekbench.com. Look at the performance score for CPU multi-core for modern hardware to know what to ask for.

Custom metrics on your PC/VM

If you feel that it is hard to pinpoint what is going on with your workstation, I recommend setting up custom metrics and alerts if you are curious about what is going wrong.

The data collector is set in the performance monitor with a sample interval of 1 second for metrics below:

  1. [Processor] “% Privileged time”
  2. [Processor] “% User time”

Alert in performance monitor with the condition for each counter to be greater or equal to 90% and a sample interval of 10 seconds for a start. Then 20 or 30 seconds for

  1. Processor(_Total)% User Time
  2. Processor(_Total)% Privileged Time

Create a scheduler task that will dump all logged alerts from Performance Monitor to the text file on the hard drive that will be accessible to both developers and the infrastructure team.

The conclusion

Always ask for fresh hardware updates, treat yourself with good gadgets, and still find time for an interesting exploratory analysis of what is going wrong with your tooling, as you are the engineer :).
Cheers!

--

--

Stas(Stanislav) Lebedenko
Microsoft Azure

Azure MVP | MCT | Software/Cloud Architect | Dev | https://github.com/staslebedenko | Odesa MS .NET/Azure group | Serverless fan 🙃| IT2School/AtomSpace