Visual Studio 2022 Performance Enhancements 17.4

Nayana Srikanth

Every new Visual Studio release includes new performance improvements that make the product faster and more responsive. 17.4 has some significant improvements across common scenarios like  Find in Files, Branch switching, configuration changes, unit testing, C++ indexing and file saving. We use product telemetry from our GA releases to set baselines, run experiments in previews to test different solutions, measure changes in controlled lab environments for repeatable results, and dogfood builds daily to test our changes. While your mileage may vary, we believe there is something here for everyone. Download Visual Studio 2022 to check out some of the improvements below. 


Find and Replace in Files 

Replace in Files on the entire solution is now 3-4 times faster! You’ll see a significant improvement in how fast you can do a bulk replacement in a large solution.  We have achieved this by making incremental improvements in the last few releases.  For example, by avoiding opening modified files while preserving the global undo capabilities, Async save, maximizing usage of caching & indexing. Stay tuned for continued performance enhancements to the Find and Replace experience. 

Based on our measurements for the 95th percentile in Preview channel, 95% of Replace operations complete within 8 sec in 17.4 whereas they used to take up to 25sec in 17.3. 

 

Image blog

 

Faster Indexing for C++ Projects 

The time it takes to open a C++ project for the first time has significantly reduced. Large C++ projects could see a 20-35% speed improvement over 17.3 when populating the source code index used for colorization and IntelliSense.  These performance gains come in addition to other improvements made in the previous release.   

You can read more about the C++ IDE experience performance improvement here  

 

Reducing solution reloads during Git branch switches 

We reduced the number of branch switches that need solution reloads by an estimate of 80%.  For example, when a developer’s change gets merged and reaches the main branch the rest of the team would have experienced a solution reload when switching to or from this branch. This scenario should no longer prompt a solution reload resulting in a faster branch switching experience.   

These improvements come in addition to others made in the past few releases, which have reduced overall branch switch times measured at ~16 seconds in VS 2019 to ~10 seconds in VS2022 for the 95th percentile.  

 

Image Branchswitching

 

.NET configuration switch responsiveness 

We addressed issues related to switching configurations, such as changing from Debug to Release in the IDE. With these changes, Visual Studio is much more responsive after making such a switch. 

Previously, when we switched configurations, we would completely tear down Roslyn’s view of the project, then create a new one from scratch. This would result in re-parsing all source files in the project. 

In practice, this new state would be very similar to the discarded one, with only a few differences. 

Now, configuration switches reuse the existing Roslyn project, updating it with only the small delta between configurations. Consequently, Roslyn can do much less work to bring IDE features up to date for the newly selected configuration, reducing wait time. 

The table below shows the performance improvements achieved between the two releases. 

Improvements  17.3  17.4  GAIN 
Inheritance Margin  51.1 sec  26.6 sec  47.90% 
Errors  60.3  27.8  53.90% 
CodeLens  128.3  38.2  70.20% 
Background tasks  219.2  89.9  58.90% 

 

Unit Test Performance 

Parallel Test discovery:

In solutions with multiple test projects, the Test Explorer now discovers the presence of tests in different test projects in parallel. This means tests are discovered and displayed in the Test Explorer much faster!   In our tests, we have seen test discovery complete twice as fast on a large solution with greater than 150 projects and close to 300K tests (on a machine with 10 CPU cores). 

Efficient parallelization of test runs:

Test assemblies are now optimally parallelized across Target Frameworks and Architectures resulting in test runs that are three times faster on a large solution with greater than 150 projects. 

Optimized communication between VS and test runner processes:

The test runner process connections are now established sooner. This means saving around 1 second on average per test assembly included in the test run. This leads to significant speed up for test runs involving a small number of tests. The communication between test runners and VS has also been tuned to be less chatty and more efficient. This leads to noticeable improvement especially for test discovery (up to 30% speed gain in many cases). 

 

Responsive File Save 

We moved most of the Save operations to a background thread allowing Visual Studio to stay responsive while documents are being saved. This enhancement is most noticeable when working on slow hard drives, network shares or editing exceptionally large files. 

 

Tell us what you think! 

 We hope these performance enhancements make your development work efficient and enjoyable. Feedback from developers like you is very important for us to improve the product and meet your expectations. We welcome your feedback in the comments section of this Blogpost.  You can also contact us at the Developer Community or via survey.

28 comments

Comments are closed. Login to edit/delete your existing comments

  • Eugene Ivanoff 0

    Creating new T-SQL query (right-click on database -> New Query) hangs VS. This is a long-standing bug.

    • Serkan Ozkan 0

      However, The new update messed up NetCore projects. They are not loading anymore. And New NetCore projects creating but cannot add or show in to project trying to solve since 2 days!

      • Michael Taylor 0

        @Serkan, did you read the blog post related to the VS release? There are issues with the new .NET 7 SDK messing up .NET 6 apps. If you refer to that blog article there are some recommendations on how to recover and some links to feedback items with additional suggestions, if you fall into this boat.

  • Muhammad Miftah 2

    Visual Studio’s UI still remains painfully slow. The underyling WPF that VS uses is still the regular .NET Framework one. I mean, MS has already ported C++/CLI to .NET Core on Windows at least; why does VS still use .NET Framework’s WPF?

    Closing a solution is still painfully slow. Rider closes a solution in a few milliseconds, but VS still manually ‘unloads’ each and every project and can take a whole minute to close a sln with more than 2 dozen loaded projects.

    Switching between debug and regular code editing views can still take several seconds. Sometimes hitting the restart-debugging button hangs VS for several seconds, even on a simple hello world console app.

    • Ajay Vijayvargiya 2

      I agree to this. All these operations are damn slow. I wish the performance/speed of VC6 (yes, VC6) is brought back to the latest one. CPUs are 100x faster, but VS is 10x slower than VC6!

    • Damian Hallbauer 0

      Yes i agree.. its obvious that typing became super slow in text edtior in the lsat update. had to roll back to 17.4

      FINALLY AFTER I BEGGED, i got the fix for surface pen ,drag and drop that works in Notepad, sleect some code and drag and drop it, durnig debug that is so important. you often just and to move a line of code up or something. i never want to touch the hot keyboard and i wnat to use tablet and touch more.. I love the surface laptiop studio becasue theres no other option for developiong androind that is as good.. the pen is veryh painful with menus or discovering variable values or expessions and it could be amazing. i cant use it with nested menus.. its grea rbut needs more attention. im not going to use it to write code tho. its too slow and id rather type.. but for debugging , using menus, drawing , CAD , selecting its great. EDITing needs work and the buttons need to be useful.

      So despite this fix, For the first time i had to roll back to 17.4,, after I went to 17.5 but it got painfully slow to type… you have ZERO competiong on this. but you WILL… unless you fix this Low hanging fruit.. so far im AMAZED AND IMPRESSED THAT i havent had to roll back before.. and that generally its stable and usable and gets better. but last week thats gotta get fixed .. the regression on performance.. I shut off copilot and everything i coujl dthink of… but the intellisennse or something got super O(N^2) complex or something and its unusuable to type.

      I was delighted wth Code / Features searchsing Net 7, and i think its generally fast, and stable, and usable. ( more so than VS code, whic is slower to me) s

      till , is
      it leaks apps.. if you cancel a debug session with unhandled exception. code feature search has wicked potential, the best of command line and bloated UI.. the pen earse button should be mappable to a key or command like undo.. by default. Sell more Surfaces!!!! it 2500 $ i had no choice or woul dhave bought a mac… ideally i want a surface ARM but not pay 2500$ for it!!! as a backup pc.. to develop native androind and such. an not have a hot keyboard.

      its hard to find and kill a leaked app when i rebuild it, file locked. .. I AM ON Microsoft Visual Studio Community 2022 now.. it regressed last update its 11/28.2022 now..
      Version 17.4.0 Preview 6.0
      VisualStudio.17.Preview/17.5.0-pre.1.0+33103.201
      Microsoft .NET Framework
      Version 4.8.09032

      Installed Version: Community

      Visual C++ 2022 00482-90000-00000-AA007
      Microsoft Visual C++ 2022

      ADL Tools Service Provider 1.0
      This package contains services used by Data Lake tools

      ASA Service Provider 1.0

      ASP.NET and Web Tools 17.4.318.48533
      ASP.NET and Web Tools

      Azure App Service Tools v3.0.0 17.4.318.48533
      Azure App Service Tools v3.0.0

      Azure Data Lake Tools for Visual Studio 2.6.5000.0
      Microsoft Azure Data Lake Tools for Visual Studio

      Azure Functions and Web Jobs Tools 17.4.318.48533
      Azure Functions and Web Jobs Tools

      Azure Stream Analytics Tools for Visual Studio 2.6.5000.0
      Microsoft Azure Stream Analytics Tools for Visual Studio

      C# Tools 4.4.0-3.22518.13+7856a68c109b22de70e07580018fec601e944f46
      C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

      Common Azure Tools 1.10
      Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

      Extensibility Message Bus 1.4.1 (main@2ee106a)
      Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

      Microsoft Azure Hive Query Language Service 2.6.5000.0
      Language service for Hive query

      Microsoft Azure Stream Analytics Language Service 2.6.5000.0
      Language service for Azure Stream Analytics

      Microsoft Azure Tools for Visual Studio 2.9
      Support for Azure Cloud Services projects

      Microsoft JVM Debugger 1.0
      Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

      Mono Debugging for Visual Studio 17.4.19 (8c0a575)
      Support for debugging Mono processes with Visual Studio.

      Node.js Tools 1.5.40817.1 Commit Hash:66443775f9f3b1d8f8fee47af5002828b346688d
      Adds support for developing and debugging Node.js apps in Visual Studio

      NuGet Package Manager 6.4.0
      NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

      Razor (ASP.NET Core) 17.0.0.2246202+61cc048d36a3fc9246d2f04625988b19a18ab8f0
      Provides languages services for ASP.NET Core Razor.

      SQL Server Data Tools 17.0.62207.28050
      Microsoft SQL Server Data Tools

      Test Adapter for Boost.Test 1.0
      Enables Visual Studio’s testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

      Test Adapter for Google Test 1.0
      Enables Visual Studio’s testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

      ToolWindowHostedEditor 1.0
      Hosting json editor into a tool window

      TypeScript Tools 17.0.10921.2001
      TypeScript Tools for Microsoft Visual Studio

      Visual Basic Tools 4.4.0-3.22518.13+7856a68c109b22de70e07580018fec601e944f46
      Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

      Visual F# Tools 17.4.0-beta.22512.4+525d5109e389341bb90b144c24e2ad1ceec91e7b
      Microsoft Visual F# Tools

      Visual Studio IntelliCode 2.2
      AI-assisted development for Visual Studio.

      VisualStudio.DeviceLog 1.0
      Information about my package

      VisualStudio.Mac 1.0
      Mac Extension for Visual Studio

      VSPackage Extension 1.0
      VSPackage Visual Studio Extension Detailed Info

      Xamarin 17.4.0.293 (d17-4@fe8fe1a)
      Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

      Xamarin Designer 17.4.0.138 (remotes/origin/d17-4@d36bba3cc9)
      Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

      Xamarin Templates 17.4.2 (c457c97)
      Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

      Xamarin.Android SDK 13.1.0.1 (d17-4/13ba222)
      Xamarin.Android Reference Assemblies and MSBuild support.
      Mono: a96bde9
      Java.Interop: xamarin/java.interop/d17-4@fcc33ce2
      SQLite: xamarin/sqlite/3.39.3@23e1ae7
      Xamarin.Android Tools: xamarin/xamarin-android-tools/main@0be567a

      Xamarin.iOS and Xamarin.Mac SDK 16.0.0.335 (8ac10db63)
      Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

  • Jarosław Jasiński 4

    17.3 was really stable and fast. But 17.4 is so slow that I had to turn off ‘Background code analysis’.

    • Hugo Ribeiro 3

      17.3 is not fast in my opinion. Code analysis is slow and hangs the CPU a lot.
      The process ServiceHub.RoslynCodeAnalysisService.exe is always very busy (between 10% and 20%) even as I write these lines and Visual Studio is not in the foreground.
      This is THE area that needs to improve the most!

      • Miles Merckel 1

        VS 2022 has a ferocious appetite for RAM. Each of my projects uses 1.5GB to 2GB or ram, if I try and open up a second project ram use is pushed to near 100% (my machine only has 16GB) then virtual ram on disk is utilised rendering my machine unusable.

        • WM Z 1

          It took me hours to identify the problem and eventually I found that it was VS’s fault. It is another story than the aforementioned ServiceHub.RoslynCodeAnalysisService.exe.

          The memory leak lies in the WPF part of VS which fails to release resources consumed by a code document window.
          Since each document window has some connection with the Roslyn code tree, you will eventually have scores of millions of syntax nodes unreleased in the VS instance. It is the reason why its appetite is so good.

          • Damian Hallbauer 0

            cna u just kill the service? or dispable live anaysis? i tried it and it didndt help…

            i try to kill lots of services when a build target is locked for a while as well.. its hard to see whtats locking my exe…

      • WM Z 0

        As an extension developer who keeps track of the new version of VS, I’ve posted the issue about the ServiceHub.RoslynCodeAnalysisService.exe before 17.4 was released publicly, with the detail and even stack trace about the problem, one month ago, however they were too slow to realize the problem and released the version despite of the problem.
        The fix was said to have been implemented two weeks ago, but not released at this moment.

        Now they are part of our environment destroyers.

    • Damian Hallbauer 0

      i think 17.5 got wayyy too slow lwo to type and tried live code analsysis.. off… mabye i missed that setting if its differnt .. to 17.4 rollback is ok for me…

  • Dean Wrigley 0

    Upgraded to 17.4.1 and now intermittently unable to run Unit Tests because Test Explorer claims it can’t find any after a Run build – even though I can see all the tests loaded in the Test Explorer window with the total tests it has found shown in the flask button at the top. On previous days I have eventually managed to do something that made the tests be found after a build but Today it says 0 Tests no matter what I do. I’m going to uninstall and install an earlier version.

    • Abhitej John BandiMicrosoft employee 0

      Thanks for reaching out Dean. We’ve released a fix for a similar symptom in 17.4.2. There might be a few other cases tied to the version of xunit/nunit that could be causing some of these issues. If you are using those test frameworks, would you mind upgrading to the latest version of the adapter and give it a shot please? The other feedback that we are actively working on that could cause this is being tracked here and it’s tied to running tests on a localized VS instance. We’d be extremely grateful if you could let us know if either of these match what you have set-up. If not, would you mind providing us a little more information through filing a feedback on developer community please?

  • Ajay Vijayvargiya 3

    Consider what’s bread butter for a developer:
    * Code writing and Editing – sometimes the editor will freeze, will get out of focus and keystroke will go nowhere.
    * Debugging – Must be super-efficient – we aren’t here to debug VS and report you the issues. We use VS to debug our programs!
    * Saving the files quickly – thanks for this and let’s see how efficient it is now (hope it doesn’t steal focus from editor to no-where)
    * Code Browsing must be really good, fast and accurate!

    Find and Replace, Branch Switching etc. are good, but IMO should not be given priorities over above-mentioned tasks that devs do more often. I know and can wait on a slow replace or git-branch-switch

    • Keith Corser 0

      SSIS extension?

      • Ajay Vijayvargiya 0

        Did you reply on correct thread?

    • Damian Hallbauer 0

      I think the Git is too risky in dev studio.. I lost a ton of work by ” bunting” an operaton from the UI its diteched mhy changes without warning . I use tortoise and the file manager for big commits.. its nicer but to stage a file shouuld be one pen touch or click.. it wants to commit everything by default. its llcleaner though and care should be taken that working on two pcs does actaulluy pull, merge and push to the top or defualt branch.. it was just way too easy to bash my own chnages from the other pc. A. fix stuff, then simply commit push.. pc B. fix stuff, pull, merge, resolve, commit push.. pc. A. pull fix from B. ( merged) , should be confilicts… fix and see new code. ( i dont) where is it? .. so now i dont pull / Merge i pull/ rebase/ fast fwd… instead.. its works. i dont know how else to do it and i dont want to expermient.

      or make it clear . now i have to pull , rebase fast fwd , push.. or it will bash changes.. At least in tortoise.. I dont dare even try it in VS. Merge should merge merge.. and branches, or different “HEADs’ or whatever.. shouldnt happen by default. Subversion wa so much easier for small teams. i dont consider my local commits, worth anything. either way i push code to cloud as soon as it works.. because na SSD can die any time. i want one branch on cloud onless i explicitly define a branch.. Each pc you clone to , has its own sort of “head” or wahtever.. or base.. thats confusing. if i want to see history ill make a branch and commit and push.. local history to me is useless. ill never commit and then not push. that laptop gets stolen, is gone. I hate stash /pop. scary and primitive. Seeing the changes history of one file ( from the vault) on my PC should be easy.. its not at all….

      . in git hub web it is. Blame isnt that useful. cannt sore by date either in tortoice and im not learning the cmd line like its 1994

      • Nayana SrikanthMicrosoft employee 0

        Hi Damian,

        Thanks for the feedback. Could you please open a feedback ticket with clear steps with a video recording to reproduce the issue?

  • Jason Baginski 0

    If things actually worked, this would be fantastic news. Since 17.4(including .1) I’m frustratingly having to exit and relaunch VS a dozen times a day due to https://github.com/dotnet/roslyn/issues/65064 It’s been over a year of dealing with the find and replace deciding to switch to “Current document” rather than “Selection”(which I’m now told the race condition has been found and might be released in Feb 2023). Seriously, you can go as fast as you want, but if it means I’m having to constantly double check fields and restart VS, it’s a net giant negative in my productivity and causes nothing but ill will towards the product.

  • Jefferson Motta 0

    I don’t know your scenario, but this last update makes the Find Files 5 times slower. Replacing all solutions takes ages. My PC is speedy but this latest update was a #fail.

  • Jiří Zídek 0

    Still miss Interactive C# against .net6/.net7 – since now we migrated almost all from .NET 4.6, C# interactive is almost useless….

  • Eli Black 2

    Lots of nice performance improvements here! The speedups when switching between branches and between .NET configurations are particularly welcome 🙂

  • ls ls 0

    `by avoiding opening modified files while preserving the global undo capabilities` what is that? what is the global undo without opening files? is it something new? as a Vsixer (VS extender) I need EXACTLY this feature, where I can read how to use it in VSIX?!))

    • Oleg TkachenkoMicrosoft employee 0

      It’s not really new actually, it’s also called “linked undo” and you can use it via IVsLinkedUndoTransactionManager service.

  • Erik Thysell 0

    I experience VS 17.4.2 as slow, hangs a lot and often the menu stops responding: I can click on the menu row and options in any list but at times it stops from doing any thing after click. Every now and then I can only close VS by killing it from Task Manager (menu->File->Exit, Alt +F4, X in top right corner – none of it responds)

Feedback usabilla icon