Как ускорить visual studio 2022

от admin

Ускоряем Visual Studio, часть III. Производительность IDE

После написания прошлой статьи, я понял, что у меня осталось еще некоторое количество информации, не относящейся к ускорению компиляции решения, но позволяющей несколько повысить производительность самой Visual Studio в процессе работы над кодом. А поскольку мы все-таки работаем над кодом изрядное количество времени, намного приятнее делать это в быстро работающей IDE. К сожалению, в этой статье не будет графиков, поскольку весьма тяжело измерить, насколько стало быстрее открываться меню или какое-то окно. Тем не менее, я надеюсь, что кто-то может найти для себя в этих советах что-то ценное и сэкономить себе немного времени.

Добавьте /nosplash к ярлыку запуска Visual Studio
Честно говоря, время запуска уменьшится не сильно, но психологически будет казаться, что Студия грузится быстрее.

Отключите кнопку F1
Это делается в «Environment->Keyboard». Вы ведь всё-равно не пользуетесь этой кнопкой, правда? А если случайно нажмёте, то, в зависимости от версии VS начнут открываться новые окна или запуститься браузер — всё это весьма долго.

Выключите анимацию
«Environment->General->Animate environment tools». Оставим анимацию фанатам красивостей. А мы ведь суровые программисты, нам ни к чему.

Отключите стартовую страницу
Она занимает время при запуске студии (в особенности, если лезет в Интернет за всякими новостями и советами). Отключается в «Environment->Startup».

Выключите «Track Active Item in Solution Explorer»
Неужели Вы правда ею пользуетесь? Если нет — выключите. Отключается в «Projects and Solutions»

Отключение разнообразных красивостей
Вот тут об этом написано детальнее. Отключается в «Environment->General->Visual experience»

Удаление лишних плагинов
Каждый плагин — это минус к производительности Студии. Если у Вас стоит что-то лишнее — удаляйте.

  • Закройте Visual Studio.
  • Удалите все .ncb файлы для Вашего решения.
  • Удалите или переименуйте файл C:\Program Files\Microsoft Visual Studio 9.0\VC\vcpackages\feacp.dll (часть «9.0» отличается для разных версий Visual Studio).

Запуск Студии и компиляция проекта перед приходом на работу
На моей рабочей машине каждое утро, за час до моего прихода на работу запускается скрипт, закрывающий Visual Studio, делающий update кода из репозитория и по-новому запускающий Студию и компиляцию решения в ней. Приходя на работу я вижу откытую IDE, в которой сразу видно текущее состояние решения (компилируется\нет) и лог процедуры update, по которой понятно что именно изменилось со вчерашнего вечера. Всё это экономит мне 10 минут ежедневно.

Name already in use

visualstudio-docs / docs / ide / visual-studio-performance-tips-and-tricks.md

  • Go to file T
  • Go to line L
  • Copy path
  • Copy permalink
  • Open with Desktop
  • View raw
  • Copy raw contents Copy raw contents

Copy raw contents

Copy raw contents

Visual Studio performance tips and tricks

Visual Studio performance recommendations are intended for low memory situations, which may occur in rare cases. In these situations, you can optimize certain Visual Studio features that you may not be using. The following tips are not intended as general recommendations.

[!NOTE] If you’re having difficulty using the product because of memory issues, let us know through the feedback tool.

If you upgrade your system from a 32-bit version of Windows to a 64-bit version, you expand the amount of virtual memory available to Visual Studio from 2 GB to 4 GB. This enables Visual Studio to handle significantly larger workloads, even though it is 32-bit process.

[!TIP] Visual Studio 2022 on Windows is now a 64-bit application. This means you can open, edit, run, and debug even the biggest and most complex solutions without running out of memory. To learn more, see both the Visual Studio 2022 vision and Visual Studio 2022 Preview 1 blog posts.

Disable automatic file restore

Visual Studio automatically reopens documents that were left open in the previous session. This can prolong the times it takes to load a solution by up to 30% or more, depending on the project type and the documents being opened. Designers like Windows Forms and XAML, and some JavaScript and typescript files, can be slow to open.

Visual Studio notifies you in a yellow bar when automatic document restore is causing a solution to load significantly slower. You can disable automatic file reopening by following these steps:

Select Tools > Options to open the Options dialog box.

On the Projects and Solution > General page, deselect Reopen documents on solution load.

If you disable automatic file restore, a quick way to navigate to files you want to open is by using one of the Go To commands:

For the general Go To functionality, select Edit > Go To > Go To All, or press Ctrl+T.

Jump to the last edit location in a solution using Edit > Go To > Go To Last Edit Location, or by pressing Ctrl+Shift+Backspace.

Use Go To Recent File to see a list of recently visited files in a solution. Select Edit > Go To > Go To Recent File, or press Ctrl+1, Ctrl+R.

Configure debugging options

If you are typically running low on memory during debugging sessions, you can optimize performance by making one or more configuration changes.

Enable Just My Code

The simplest optimization is to enable the Just My Code feature, which only loads symbols for your project. Enabling this feature can result in a significant memory saving for debugging managed applications (.NET). This option is already enabled by default in some project types.

To enable Just My Code, choose Tools > Options > Debugging > General, and then select Enable Just My Code.

Specify symbols to load

For native debugging, loading symbol files (.pdb) is expensive in terms of memory resources. You can configure your debugger symbol settings to conserve memory. Typically, you configure the solution to only load modules from your project.

To specify symbol loading, choose Tools > Options > Debugging > Symbols.

Set the options to Only specified modules instead of All modules and then specify which modules you care to load. While debugging, you can also right-click specific modules in the Modules window to explicitly include a module in the symbol load. (To open the window while debugging, choose Debug > Windows > Modules.)

Disable Diagnostic Tools

It is recommended that you disable CPU profiling after use. This feature can consume large amounts of resources. Once CPU profiling is enabled, this state is persisted across subsequent debug sessions, so it’s worth explicitly turning it off when done. You may save some resources by disabling the diagnostic tools while debugging if you do not need the provided features.

To disable the Diagnostic Tools, start a debugging session, select Tools > Options > Debugging > General, and then deselect the Enable Diagnostic Tools while debugging option.

For more information, see Profiling Tools.

Disable tools and extensions

Some tools or extensions can be turned off to improve performance.

[!TIP] You can often isolate performance issues by turning off extensions one at a time and rechecking performance.

Managed language service (Roslyn)

For information about .NET Compiler Platform («Roslyn») performance considerations, see Performance considerations for large solutions.

Disable CodeLens

Visual Studio performs a Find All References task on each method as it is displayed. CodeLens provides features such as the inline display of the number of references. The work is performed in a separate process such as ServiceHub.RoslynCodeAnalysisService32. In large solutions, or on resource-constrained systems, this feature can have a significant impact on performance. If you’re experiencing memory issues, for example, when loading a large solution on a 4-GB machine, or high CPU usage for this process, you can disable CodeLens to free up resources.

To disable CodeLens, choose Tools > Options > Text Editor > All Languages > CodeLens, and deselect the feature.

[!NOTE] CodeLens is available in the Professional and Enterprise editions of Visual Studio.

Other tools and extensions

Disable Extensions

Extensions are additional software components added to Visual Studio that provide new functionality or extend existing functionality. Extensions can often be a source of memory resource issues. If you’re experiencing memory resource problems, try disabling extensions one at a time to see how it impacts the scenario or workflow.

To disable extensions, go to Extensions > Manage Extensions, and disable a particular extension.

Disable map mode

Map mode displays lines of code, in miniature, on the scroll bar. Map mode is enabled by default.

To disable map mode, go to Tools > Options > Text Editor > All Languages > Scroll Bars, and in the Behavior section, deselect the Use map mode for vertical scroll bar option.

Disable word wrap

Word wrap displays the portion of a long line of code that extends beyond the current width of the code editor window. Word wrap is on by default.

To disable word wrap for a project that you are currently working on, go to Edit > Advanced > Word Wrap. (You can toggle this setting by using the same menu commands.)

To disable word wrap for all projects, go to Tools > Options > General > Text Editor > All Languages > General, and in the Settings section, deselect the Word wrap option.

Disable XAML Designer

The XAML designer is enabled by default, but only consumes resources if you open a .xaml file. If you work with XAML files but do not wish to use the designer functionality, disable this feature to free up some memory.

To disable XAML Designer, go to Tools > Options > XAML Designer > Enable XAML Designer, and deselect the option.

Remove workloads

You can use the Visual Studio Installer to remove workloads that are no longer used. This action can streamline the startup and runtime cost by skipping packages and assemblies that aren’t needed anymore.

Add untracked files to local .gitignore

Visual Studio runs the Git command git status with untracked files to provide a seamless experience when you add new files to a repository. When there are a large number of untracked files, git status can consume extra memory. To ignore these files and improve performance of git status , you can add these files or folders to your local .gitignore file. To access the file, go to Git > Settings > Git Repository Settings. Then, in the Git files section, click Add to create a .gitignore file, or click Edit if you already have one.

Enable commit graph in Git tooling

New in Visual Studio 2022 version 17.2: If you’re experiencing delays when you view your Git repository or branch history in Visual Studio, we’ve integrated a «commit graph» feature that can help. To use commit graph, make sure you download and install Visual Studio 2022. To learn more about commit graph, see the Supercharge your Git experience in Visual Studio blog post.

Force a garbage collection

The CLR uses a garbage collection memory management system. In this system, sometimes memory is used by objects that are no longer needed. This state is temporary; the garbage collector will release this memory based on its performance and resource usage heuristics. You can force the CLR to collect any unused memory by using a hotkey in Visual Studio. If there is a significant amount of garbage waiting for collection and you force a garbage collection, you should see the memory usage of the devenv.exe process drop in Task Manager. It’s rarely necessary to use this method. However, after an expensive operation has completed (such as a full build, debug session, or a solution open event), it can help you determine how much memory is really being used by the process. Because Visual Studio is mixed (managed & native), it’s occasionally possible for the native allocator and the garbage collector to compete for limited memory resources. Under conditions of high memory usage, it may help to force the garbage collector to run.

To force a garbage collection, use the hotkey: Ctrl+Alt+Shift+F12, Ctrl+Alt+Shift+F12 (press it twice).

If forcing garbage collection reliably makes your scenario work, file a report through the Visual Studio feedback tool as this behavior is likely to be a bug.

For a detailed description of the CLR garbage collector, see Fundamentals of garbage collection.

Optimizing your Visual Studio Code in 2022

In this article we’ll be covering useful extensions, plugins and settings needed in order to ease and speed up development and production in Visual Studio Code.

Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux.

I’ll be assuming you already have VS Code installed and running but If you don’t, head to Visual Studio Code to download it.

home

LET’S GET STARTED

1. Settings and Tips

  • Bracket Pair Colorization

Bracket pair Colorization is now native on VS Code so there is no longer use for the the old reliable Bracket Pair Colorization extension.
Follow the steps below to try it out:

vscode settings

  1. Make sure to remove the Bracket Pair Colorizer extension.
  2. Update VS Code
  3. Open your user settings via CMD ( CTRL for non-Mac users) + Shift + P and type settings. The settings JSON file will open. Add the following:

Exit fullscreen mode

  • Emmet

With Emmet, we can write shortcuts and then expand them into a piece of code. An example is

Exit fullscreen mode

Here we are trying to create an unordered list element with 3 items with a class name of «num» inside. Notice that the class name also comes numbered below:

Exit fullscreen mode

NB: Checkout the Interactive Editor Playground page in VS Code, it highlights a number of editor features. In this section you can also find a link to the Emmet Cheat Sheet, which is super useful.

linked editing setting

  • Linked Editing

It is a built-in feature of VS Code, separate from the Auto Rename Tag extension. Depending on the language, related symbols, e.g HTML tags, are updated while editing.

2.Extensions and Plugins

Live Server

Live Server

It gives you the ability to Launch a local development server with live reload feature for static & dynamic pages.

VS Code Icons

VS Code Icons

Introduce beautiful icons to your VSCode. Give your IDE a new and easy feel.

Code Time

Code Time

Code Time is an open source plugin for automatic programming metrics and time tracking in Visual Studio Code. Join our community of over 200,000 developers who use Code Time to reclaim time for focused, uninterrupted coding. Protect valuable code time and stay in flow.

VS Code intellicode

VS Code Intellicode

This extension provides AI-assisted IntelliSense by showing recommended completion items for your code context at the top of the completions list. It really helps speed things up.

ESlint and Prettier

ESlint & Prettier

If you are working in an organization or a team that enforces a format or standard for code then you can adopt either of the above mentioned tools.
ESlint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code whereas Prettier is an opinionated specialized code formatting tool. They are both used to help developers maintain a consistent style. They can also work hand-in-hand.

Conclusion

There are many other useful extensions and settings specific to the language you choose to work with, but I will cover them in another article or video. For now, with this guide, I hope that I was able to introduce you to some easier ways of doing things. Stay happy coding and see you in future posts.

VS 2022 Super Laggy

Just started running VS 2022 Enterprise last week. Intellisense/code is horribly slow. Taking multiple seconds for code suggestions. I have to quadruple double click on quick actions, sometimes it doesnt work at all. Trying to ctrl-click to navigate to implementations is spotty at best. Highlighting works sometimes and other times not at all.

Running Windows 11 on a Ryzen 3950x with 64gb ram and an RX480 gpu. vs2019 does not suffer from these same issues and vscode is lightning quick.

Anyone else experiencing these things? Any suggestions?

I am from Visual Studio Perf team, I am sorry that you are running into this issue. I would like to help take a look. Can someone help get on a chat with me so I can follow up? I will DM! Thank you in advance!

Create a new Angular project with a ASP.Net core backend. Sample project would be sufficient. Then try modying the typescript code a bit and see how long intellisense takes to catch up.

Try on VS2019 then compare to 2022. It's trivially easy to reproduce the issues !

I have the same issue. Was a general solution to this problem found? Would love some help because I don't know where it's comming from, perhaps a misconfigured solution, as the hardware should be more than capable of handling it. Makes the IDE unusable for me atm but I would love to keep using it as Rider and VS Code never grew on me.

I mean, we all have to debug stuff, providing NO CONTEXT of your project or what you're working with is not that useful.

What refresh rate is your monitor running at?

One monitor is 60 the other 144 with free sync enabled. The problem happens on either monitor.

Yup, same. I upgraded from 16Gb to 32Gb which improved things, but it's still noticably slower than 2019.

Typescript intellisense is a joke and completely unusable. c# Intellisense is better, but still much slower than VS 2019.

This was happening to me too during the preview releases, RC and RTM.

I had a bad analyzer/code generator referenced in one of my libraries. It took me a couple of very frustrating weeks to figure it out. After I removed the code generator Visual Studio was almost snappy!

Mine is perfectly normal and much faster than VS 2019.

Same here. Better response, I used to out-type VS2019 regularly, but not on 2022. And don't get me going on the ML autocomplete.

is 2022 on an ssd?

Same, vs2022 has been nothing but a big pain ever since I upgraded, I just wish I could go back.

My designer constantly malfunctions and my properties tab would freeze and lock some of the buttons (most of the time the color resources). Simply moving the grid would mess the children and some of them would eat the next column or row.

Service-based databases has also been infuriating to work with, I could only update a query once and after that all queries, even just a name change, would just loop the preparing dialogue box even after leaving it for hours. The only fix is to reboot everytime you wanna change something in the database.

impossible to work, I have a solution with 4 projects and a lot of classes, but intelligent it is very slow, it takes about 2 min to compile, errors come out randomly, I have to restart visual studio close the tabs to get the right errors out, the references that are missing cannot suggest them

let me rant a bit. horrible programming. lots of bugs they fail to fix since 2017.. i have a project with lots of migrations(i know this is the issue) and that causes my visual studio to eat lots of memory to around 16 gbs and then i go out of memory, also the disk goes 100% utilization just unusable, when trying to compile, it never ends i just could sit around hours waiting to finish. failed product just fix it already

Yep same problems on VS2022 Professional it gets into such a mess that the compiler doesn't report any issues in the code intellisense takes a good 2 seconds to catch up by this point and eventually all I see is an "CSC error couldn't find a dll" — great.

VS2022 feels good initially but its got way too many problems I suspect they all stem from the Roslyn Code Analysis and the Intellicode feature and the latter option is missing and the Roslyn Code Analysis is such a problem I have to quit VS.

Temporary workaround for me was to stop/disable BITS on my Windows 2k16 Server (A dev VM I have to use).

The same on Windows 10 Pro also brought VS2022 back to life. I have a interesting issue where by my version of VS2022 Professional version 17.0.2 doesn't have the Intellicode option in the menu or the checkboxes to control Roslyn

Similar issue. VS 2022 was much slower than VS 2019.

I disabled everything related to intellicode and everything is going much faster

better use notepad then lol

Please tell me there's at least a way to get it to run and load faster and there's a way to get it to just open ready to write code without selecting all the nonsense and setting this setting that open this expand that and select this load that enable this enable that and the other thing collapse that close this menu and that 'tool' and this slideout and that window taking up working space steps it makes me have to do with it before I can start working. That's irritating. Not convenient. How do I get it to just open so I can write code, and if I get it doing that what's the benefit of using it if I can work faster writing my code in notepad++?

Читать:
Как найти проекцию точки на прямую

Похожие статьи