Visual Studio 2022 Performance Enhancements 17.4
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.
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.
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.
.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.
|Inheritance Margin||51.1 sec||26.6 sec||47.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.