share
Stack OverflowVisual Studio optimizations
[+517] [47] lomaxx
[2008-08-12 03:53:53]
[ .net visual-studio ide ]
[ http://stackoverflow.com/questions/8440/visual-studio-optimizations ] [DELETED]

Visual Studio is a pretty awesome IDE [1], but sometimes you just wish it would go faster. I was wondering if people have any tips or tricks to help speed up Visual Studio in day-to-day use.

Things that I'm particularly interested in are speeding up build times and switching aspx files from source to design view seem to bring it to a grinding halt.

Having said that, I'd be keen to hear anything that anyone uses to make Visual Studio run that little bit faster.


Edit: Merged answers from a related question, covering Visual Studio 2008 SP1. Please include any optimisations specific to the latest IDE.

(25) "pretty awesome" is not good enough anymore! - user37468
see also stackoverflow.com/questions/1305709/… - Ian Ringrose
(4) @pbartek nothing is "good enough" forever.. :) - Macke
(1) VS2010IDE is better :D - Anonymous Type
(2) odd that this has a lower score than amount of favorites/stars... - Robert S Ciaccio
(14) 'Not constructive'? Obviously hundreds of people find this post useful. - Colonel Panic
(1) @Matt Hickford. Just the mods on another boring powertrip. - Iain Holder
[+423] [2008-08-12 04:21:04] jfs [ACCEPTED]

Here's my list. All of these can be accessed on Tools -> Options menu:

  1. Disable F1. (Environment -> Keyboard) This is probably the best advice that I found somewhere.
  2. Disable "Animate environment tools" (Environment -> General).
  3. Disable Start Page (Environment -> Startup).
  4. Disable "Track Active Item in Solution Explorer" (Projects and Solutions).
  5. Disable Navigation Bar (Text Editor -> C#). I think this is available for every language.
  6. Set "AutoToolboxPopulate" to false (Windows Forms Designer).
  7. You can set the Code view as the default view when viewing Windows Forms. Just right-click on the .cs file and select "Open With...".
  8. Open Visual Studio using the command line (devenv) rather than using the Start menu. I don't know why, but I notice it loads faster.
  9. Turn off Track Changes. (Text Editor->Track changes)

Basically I just customized John Lam's settings [1]. It's very minimal.

Last Resort:

  • Reset all settings (Tools -> Import and Export Settings -> Reset All Settings)

Related articles:

@Orion Edwards:

I agree. Snippets are really a time saver. Actually there's a snippet editor that you can use, and I'm using it for a while now. You can find it at Snippet Editor [6].

[1] http://iunknown.com/2007/06/vibrant-ink-visual-studio-and-vim-settings.html-0
[2] http://weblogs.asp.net/scottgu/archive/2006/09/22/Tip_2F00_Trick_3A00_-Optimizing-ASP.NET-2.0-Web-Project-Build-Performance-with-VS-2005.aspx
[3] http://weblogs.asp.net/scottgu/archive/2007/11/01/tip-trick-hard-drive-speed-and-visual-studio-performance.aspx
[4] http://dotnettipoftheday.org/tips/speedup_visual_studio.aspx
[5] http://dotnettipoftheday.org/tips/optimize_launch_of_vs2005.aspx
[6] http://www.codeplex.com/SnippetEditor

(26) +1 for the F1 key remove! always wanted to change that. thx! - Peter Gfader
A new computer also really helps. The difference between my office computer and my personal is really big. - Oakcool
(8) What about unload projects where possible. I sometimes have solutions with 10 to 15 projects in if I disable the ones I am not currently working on I get a good boost. Just have to remember to reload and build before any breaking changes to shared code. - PeteT
(8) A small wrinkle on disabling the start page: I find "Recent Projects" on the start page very useful, as hovering over a project name provides the full path to the project/solution in the status bar. Rather than disabling the start page, I clear the Start Page news channel. Still get snappy loading, plus useful info. - Dan Blanchard
(7) Why F1 could slowdown VS? Why?? :-o - Isaac
(50) Isaac, I think the biggest problem with F1 (at least it is for me) is that it is too easy to press by mistake when you try to press escape, and it takes forever to load the help if you do happen to hit it by mistake. - Doug McClean
Once I was made to use a keyboard which had touch sensitive F1-F12 keys, but thats where I would rest my hands when not typing. So this would have been very helpful back then :-) - Nippysaurus
(4) F1 speed problem in VS2010 is no longer relevant - Pierre-Alain Vigeant
(2) The 'track active item in solution explorer' is how I find files in a large solution. Otherwise good stuff. - George Stocker
(3) @Dan Blanchard - This is where the extra functionality of Windows 7 really shines - "Recent Projects" show up in the list when you open the right-click/mouse drag up menu from the taskbar, and it also lets you pin solutions/projects you use often, as well as providing the functionality of seeing the path when you mouse hover. - Zannjaminderson
Disabling the start page works, but what I've found really slows it down is the RSS feed. Remove that, and it doesn't seem to effect start-up, and you get to keep your recently-used list :) - Groxx
I truly love #5 navigation bar.. - Elaine
Navigation bar seems like a feature rarely used, but I find it indispensable when working with long generated code files with lots of classes in them (think of generated EF code or web/wcf service proxies etc.). In normal situation this is not a problem, because we keep one class per file, but generated ones are different. - Robert Koritnik
Visual Studio 2012 : Disable "Preview Tab", under Environment -> Tabs and Windows - LordScree
1
[+61] [2008-08-27 15:15:10] Dan Mitchell

I use keyboard macros (Ctrl + Shift + R) to get repetitive tasks done; you have to get the knack of it at first, but once you do, you can do a lot of stuff pretty quickly. For instance, you have:

DoStuff(1,2,"foo");
DoStuff(3,4,"bar");
DoStuff(123,123421,"baz");

... and so on for many lines, and you want to insert 'true' between the first and second arguments.

Put cursor at the start of the first line, then:

  1. Ctrl + Shift + R [start recording]
  2. Ctrl + F [open 'find' dialog]
  3. , enter Esc [go to the next comma, close the find dialog]
  4. type 'true,' [new text]
  5. down, home [go to the start of the next line, so you're where you started]
  6. Ctrl + Shift + R [stop recording]

Now you can just hit Ctrl + Shift + P many times, and it'll do that set of steps over and over again.

That's a simple example; you can do a lot of refactoring-like stuff pretty quickly this way, but it's also handy for wrangling big chunks of text for manual batch operations or whatever.

I'm sure if I learned how to do regular expression search/replace, I could do the same sorts of things that way, but I got into this habit from using Brief [1] a long while ago, and I've stuck with thinking about "doing tasks the way I do them by hand", rather than turning them into regular expressions.

(Presumably, refactoring tools could do that particular operation, but I'm in C++ and none of them work very well there.)

Other things:

  • CommentReflower is a great add-in if you tend to write big chunks of comment; the original's here [2], and there's a Visual Studio 2008 port here [3].
  • Ctrl + K Ctrl + F -> automatically re-indent code, useful when things have got messy.
  • If you need to make the same change to a bunch of project settings, don't forget you can do find-and-replace-in-files on .vsproj files.
[1] http://en.wikipedia.org/wiki/Brief_%28text_editor%29
[2] http://commentreflower.sourceforge.net/
[3] http://www.kynosarges.de/CommentReflower.html

(1) Downrated because it doesn't address the question at all. - Doug
(3) Upvoted because it is very similar to the accepted answer. Recorded macros are really nice (didn't know VS has them and have been using notepad++ for that) but in this case, something like Eclipse's 'refactor method' is what you really want. - Nate Parsons
One advice: Take the time to properly learn regular expressions. You'll be able to use them elsewhere as well (in your projects, in other editors i.e. Notepad++ etc.). - Robert Koritnik
Someone needs to learn Vim instead. There's VsVim (free VS2010+) and ViEmu plugins (commercial, all versions - as well as Office/Outlook) to integrate into Visual Studio, if you want - sehe
2
[+52] [2008-09-17 13:16:09] Charles Anderson

You can improve the speed at which Visual Studio starts up by using the '/nosplash' option. Bring up the Properties of your Visual Studio shortcut, change to the Shortcut tab and amend the Target field as follows:

"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe" /nosplash


Yay... finally i found this tip! Knew something like that existed, but couldn't remember. - Arnis L.
(10) Does this really improve the actual speed, or just the perceived speed? - Kyralessa
(4) Here is my command forcing VS to run with high priority. C:\WINDOWS\System32\cmd.exe /c start "runhigh" /high "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /nosplash - Valamas
(2) "Does this really improve the actual speed, or just the perceived speed?" --- Is there a difference? *rings small chime bell* - Iain Holder
3
[+42] [2009-02-02 13:47:16] Nicholas

One of the best enhancements I've found is to disable the onaccess scan of your anti-virus for the folder where your projects reside. Every time I did a build, the I/O activity caused by the virus checker decreased the speed.


If you are able to do this, also try setting the process priority of the virus checker lower than normal. - Mike Atlas
(9) for the love of all things sacred, just don't use an "anti"virus - Nico
(1) To disable Windows Defender helped me groovypost.com/howto/microsoft/vista/… - nubm
@Nico Well, I used to sabotage corporate virus scan until they caught on (after 18 months). I was forced to reenable. In the mean time I had been able to arrange an exclusion for the working trees, and I still bring in my own external eSata SSD to get anywhere close to reasonable performance... - sehe
4
[+36] [2008-09-25 13:02:33] norheim.se

I have a couple of recommendations regarding the build speed for Visual Studio 2008, related to the copying of files that occurs during the build.

Apart from the obvious recommendation of keeping the solution files small:

Defragment your hard drive

Disk performance is vital to the build speed. A daily, or at least, weekly defragmentation will facilitate this. If possible, schedule a nightly fragmentation to be performed automatically. Also, make sure you have plenty of room on the disk. The less space that is available, the fewer choises are available to the file system when deciding how to layout the files on the disk, and the faster the entropy on your disk will increase. Do you have several Source Control branches of your code checked out - why not delete the binaries from the old ones? You are likely to recompile them when you get back to working on those branches anyway.

Avoid Unnecessary File Replication

The standard setup for .NET solutions is that each assembly gets its own bin directory to which it is copied along with the assemblies of all its dependencies. If your solution contains an .EXE file and, say, 40 different assemblies. Does it really make sense to copy the dependencies of each assembly to each separate build directory? The target directory of the EXE should be enough. Another way to accomplish roughly the same would be to give the assemblies common output directories. That also avoids the copying. Some earlier versions of Visual Studio did not support this well, so be careful. I have, however, been using this approach with VS2008 for quite a while without noticing any problems.

Disable System Restore (Windows XP ONLY)

The implementation of System Restore in Windows XP actually creates backups of every DLL in the system every time they are modified. As compiling a .NET solution involves copying and overwriting many DLLs, this is assumed to impede performance. Windows Vista and Windows Server 2003 does not suffer from this problem. If you keep your source files on a separate logical drive, you can disable system restore for that particular drive and keep it enabled on your system disk.


(1) Seconding the recommendation to defrag; building our app on my machine went from 40-70 minutes down to 15-20 after cleaning up and defragging. I was amazed how much difference it made, to be honest. - Dan Mitchell
(7) Use an SSD drive instead of a traditional HD - Peter Gfader
5
[+26] [2008-09-22 13:35:26] Gareth D

Ensure 'Only build startup projects and dependencies on Run' is selected.

This option can be found under Tools -> Options... -> Projects and Solutions -> Build and Run.

For large solutions this can save a significant amount of time.

NB it's propbably best practice to avoid very large solutions, but if you are forced to work with one then this can make all the difference.


(6) Note that you can configure your own build configurations (on top of debug and release), I have one called 'work in progress' where I only rebuild the projects I know I'm working on. - Benjol
This, to me, is the best way to increase performance. It's painful to spend 10 minutes building an entire solution just to run something that should only require a few projects to build. - drharris
6
[+25] [2008-09-18 12:35:17] HidekiAI

My experiences are more for C++ than C#, but here goes... I'm taking "Optimizations" in an ambiguous term on multiple views (code optimizations, IDE speed up, compilation speed up), but they are all specific to Visual Studio environment.

  • For optimizations in code, have the compiler optimize by size rather than speed, not sure where I've heard this but someone once told me Microsoft compiles all their applications this way as well. Whether it is a myth or not, to me at least it makes sense (in most generic cases) because smaller code called often will have less cache miss. This is more for C++ than CLR based languages. Alternatively, if you know your target platform, you can probably target that rather than generic x86.
  • For speeding up in Visual Studio, I've noticed that if I have break-points view showing, it keeps flashing, as if it is updating over and over, so I hide it. Perhaps it is just me (and psychological).
  • For speeding up compilations, on one of the projects, it used to spew 1000+ warnings (it's a project mixed with C# and C++), and it used to take 20 minutes to compile (all the warnings was because of this [1]). The point here is, having a lot of messages serialized to output causes slowdown, so pay attention to first sign of your warnings and fix it. I'd also imagine that Visual Studio's "Error List" panel has to collect the Warnings and Errors into that view, which causes extra slowdown when you have large amount of warnings.
  • Another speed-up for compilations, as somebody as mentioned, is Xoreax's IncrediBuild [2]. But they don't work on C# (yet), only on Managed/Unmanaged C++. I used to be skeptical about distributed compilation because of my experiences with distcc, but it was because all my PC's at home are different speed, a heterogeneous distribution. At work, because of the homogeneous structure where all have similar speed, it works better. Also, distributed computing is only useful when you have machines to distribute to (* grin *) Somebody also mentioned Visual Studio's parallel compiling option (if you have multi-processors, you've probably seen messages while compiling of "1> Compling Proj1", "2> Compiling Proj2" (or something like that), where Visual Studio will compile N projects (where N = number of processors you define in your options). Unlike IncrediBuild, VS distributes by projects rather than by files, and this is only useful if you have multiple projects in single .SLN.
  • Another speed-up for compilations, some have mentioned increasing memory, although that would probably help, from my experiences, a faster drive is more beneficial than memory. I've seen 2 (similar performance) PC's compile the same exact projects side-by-side, one with faster drive than another, and the gain is significant. Bottlenecked on file I/O writing the .OBJ file or seeking for .cpp file, you get the picture. Back in the old-days, we used to output all the .OBJ files to RAM drives instead of hard-drives and that sped up a lot. But today, projects are probably too large to fit in a RAM drive or the performance of drive is so much better that it's not significant to do this.
  • For speeding up in Visual Studio for debugging, if you don't need it, don't include the symbols from Microsoft [3] and you'll notice that your debugger loads faster into your applications.

I will edit/add more as I think of it.

[1] http://support.microsoft.com/kb/922271
[2] http://www.xoreax.com/
[3] http://support.microsoft.com/kb/311503

+1 for outputting .obj files to RAM. Haven't tried it yet, but it sounds like a genius idea - zildjohn01
with respect to your first suggestion, compiling for size. That comes from "Debugging Applications for .NET and Windows" by John Robbins, which is an excellent book in many respects. However, it is pretty old by this point (8 years and his knowledge about MS is from before that). My, admittedly limited, test with this flag show a huge performance hit choosing that flag in the VS2008/10. So, while that might have been true with older processors and compilers it is worth reevaluating and should be applied only with rigorous testing. - Steve
7
[+18] [2009-11-18 10:23:22] Alex

Life Changing XAML Editing Tip

If you get annoyed at Visual Studio hanging for a few seconds when you try and edit XAML, using Life changing XAML tip for Visual Studio [1] will improve things no end. It works so well I don't really understand why it's not the default behaviour.

[1] http://weblogs.asp.net/fmarguerie/archive/2009/01/29/life-changer-xaml-tip-for-visual-studio.aspx

WOW!!! It works! Even on VS 2010 - Andrei Rinea
This is the most effective visual studio performance tip I have come across. (VS 2010) - J Cooper
In case the link ever breaks, here is the tip: Right-click on a XAML file in the Solution Explorer, Select "Open With...", Select "Source Code (Text) Editor", Click on "Set as Default", Click OK - Austin Thompson
Thanks, xaml development is terrible, it was the reason I was looking for improvements. - MrFox
8
[+15] [2010-10-22 10:04:13] Ben

From my empirical testing, Visual Studio experiences an inverse linear relationship between UI responsiveness and number of projects "loaded". When I say "Visual Studio", I really mean "Visual Studio and ReSharper", because AFAIK most people work with ReSharper or a similar tool installed. I do not know if this slowdown is seen without ReSharper.

Reducing the project count is not always possible or desirable. However, unloading projects you are not currently working on mitigates the performance issue. BUT, doing so can break the build from with Visual Studio and/ or cause problems to be hidden when you make a change that affects an unloaded project.

THE SOLUTION: "unload" all projects you are not working on (or as many as is needed for performance to be tolerable) and perform builds from the command line, using the multi processor option.

This approach ensures Visual Studio remains responsive and useful, whilst at the same time a full compilation is performed.

This sounds like a very simple solution, and it is - but it can have a HUGE impact on productivity.

In summary - for large solutions use visual studio as a plain-old text editor and leave the compilation heavy lifting to MSBuild, invoked externally from the command line.


(3) As an added bonus, if you group your projects into a solution folder, you can unload/reload a batch of projects at a time. - Paul Alexander
9
[+14] [2010-05-31 12:46:32] jvenema

Empty your Recycle Bin [1].

[1] http://mhinze.com/slow-file-delete-visual-studio/

10
[+14] [2010-10-06 07:15:05] Martin S.

Also: turn off HTML and CSS validation, making it easier to spot the actual errors in the Error list.

Under Tools -> Options -> Text Editor

  • Turn off HTML validation: HTML -> Validation -> Untick 'Show errors'
  • Turn off CSS validation: CSS -> Miscellaneous -> Untick 'Detect errors'.

(Use Firefox's HTML Validator instead, or similar)


FWIW, errors in HTML/CSS are “actual errors”. Why should they be turned off? - Konrad Rudolph
(5) Because we're better off validating HTML and CSS elsewhere, rather than inside Visual Studio. You'd very often want to see actual build errors in the Error list rather than HTML and CSS errors - which, actually might not be errors - only Visual Studio misinterpreting web standards. Also, Visual Studio doesn't have support for XHTML Strict and I guess that means no validation for XHTML Strict, which probably is one of the most used doctypes on modern websites. - Martin S.
11
[+12] [2008-08-12 05:53:41] The How-To Geek

I find that if you are using a solution with a ton of files, the detection for file changes slows things down, especially if you are editing files on a shared folder. This doesn't work as well if you use a command-line source control system, of course.

  • Environment \ Documents \ "Detect when file is changed outside the environment"

Note that the same setting exists in almost all editors, and makes a big difference when editing files on a share.


12
[+12] [2010-04-22 12:41:04] RHaguiuda

This is not a Visual Studio enhancement, but Windows enhancement.

There is a tiny tool called KatMouse [1] that I cannot live without. KatMouse make any window or component scroll without focus, when mouse pointer is over it and mouse wheel is used. So you don`t have to click the window or component to set focus and then scroll, you can just point mouse over it and scroll.

Very useful for programmers of course!

However, this does not work in Visual Studio 2010 as they have a custom window management.

[1] http://ehiti.de/katmouse/

(1) sweeeeeeeeeeeeeeeeeet :) - davsan
(2) I <3 KatMouse. I keep it in my dropbox so I can always install it on any new windows machines. - Robert S Ciaccio
Does it also work for dropdown boxes/list boxes? It annoys the hell out of me that any use of common controls seems to involve multiple clicks, only on windows - sehe
Yes, it does work with comboboxes and list boxes without focus too. - RHaguiuda
13
[+11] [2008-09-06 18:43:00] Owen

One thing that can speed things up significantly is turning off IntelliSense [1]. Of course that will probably slow you down. But at my office we use Visual Assist X [2], which albeit isn't free, but is better in a number of ways.

In any case, IntelliSense can't be disabled with a dialog box checkbox (as far as I know) but the process is pretty straightforward:

  1. Close Visual Studio.
  2. Remove the .ncb file next to the .sln file for any solution you work with.
  3. Delete or rename the file C:\Program Files\Microsoft Visual Studio 9.0\VC\vcpackages\feacp.dll. (The 9.0 part of the path will be different for versions other than Visual Studio 2008.)
  4. (optional) Install some IntelliSense alternative like Visual Assist X, or prepare to do a lot more typing.
[1] http://en.wikipedia.org/wiki/IntelliSense
[2] http://en.wikipedia.org/wiki/Visual_Assist_X

(1) Careful about this - We've deleted the .ncb file and replaced it with a .ncb folder (eliminating the ability to create intellisense files) and it has played havoc with the Windows Form Designers... especially when you have custom controls - Fry
(1) i think NCBs are for C++ only - Lucas
that was sweet :) - davsan
downvoted just because I wouldn't ever ever want to disable intellisense - Nico
(1) @Nico do you do C++ programming? - sehe
14
[+10] [2008-08-12 04:44:11] Orion Edwards

This is not related to performance of the IDE (buying more RAM and an SSD [1] goes a long way towards that), but to the performance of you (that is, your personal productivity).

Learn about and use snippets, and the advanced text editor shortcuts.

Once you learn to use the snippets in E Text Editor [2] and TextMate [3], you'll never want to code without them, and Visual Studio 2005 and Visual Studio 2008 can support snippets.

Unfortunately, the Microsoft Snippet syntax is verbose and crappy (XML!), and there's no inbuilt-editor, you have to roll the .snippet XML files yourself and import them, but it's still well worth doing.

For example, I have a snippet, asnn, which expands to Debug.Assert( [object] != null );.

That alone has made it noticeably nicer to use.

I also have Ctrl+Shift+k bound to Edit.LineDelete and Shift+Enter bound to Edit.LineOpenBelow - mimicking E/Textmate. Those are awesome.

[1] http://en.wikipedia.org/wiki/Solid-state_drive
[2] http://en.wikipedia.org/wiki/E_Text_Editor
[3] http://en.wikipedia.org/wiki/TextMate

I think Shift+Delete is default bound to Edit.LineDelete - goldenratio
Re#er live templates works great. - Arnis L.
Nice idea, thanks! Optimized it by shortening the snippet to 'ass'. - UserControl
Ctrl+Shift+l is also bound to Edit.LineDelete, I believe. Not sure why k would be better. - Doug McClean
Downvote because your perjorative characterisation of the OP is nothing to do with the question asked. Snippets and shortcuts are useful, but don't solve the problem specified and it's obvious you are aware of this. It seems to me you've just deliberately taken the opportunity to snark. - Tom W
@Tom W - WTF?!? It's not snarky at all, and It had nothing to do with the OP. My point was saying that you (the "general" you) can improve your productivity by using snippets/etc, but this isn't related to the performance (in terms of execution speed/memory usage/etc) of visual studio itself. - Orion Edwards
@Doug McClean - k is arbitrary, it just happens to be what I'm used to from the other editors I use - Orion Edwards
It's taken a couple of readings but I suppose I can see where I misunderstood your tone. Your point would have been a lot clearer if you'd started "This post is not related to...". I'm sure you can see how it would be easy to interpret as "You think visual studio is slow because you're slow, not because it is". Downvote rescinded. - Tom W
15
[+10] [2008-08-12 06:11:30] Lars Mæhlum

Increasing the speed of Visual Studio? Why not instead increase your efficiency with the tool instead?

I use ReSharper [1] at all times when programming in C#, and though it will slow down Visual Studio pretty bad, I still code way faster with it..

But I am very exited about the supposed performance gains in Visual Studio 2008 SP 1. Visual Studio 2008/2005 was an enormous performance boost, and I hope they can keep it up.

[1] http://en.wikipedia.org/wiki/ReSharper

Agree, for middle-size projects you'll need at least 2 GB or RAM. On my machine (Pentium D 3 GHz, 4GB RAM) ReSharper is not usable for files that have more that 2000 lines of code. - Michael Damatov
(1) I can't for the life of me understand why anybody would want to cram 2k lines of code into a single file? - Lars Mæhlum
(1) Resharper 4.5 will be out shortly, and the beta version is much faster than 4.1. - womp
Yeah, too bad the beta version was a bit too buggy for my taste. Maybe there is a new one out? - Lars Mæhlum
(1) ReSharper 4.5 is still too slow, and causes me to wait minutes while it updates it's cache and parses my files. But the productivity tradeoff is still positive, so I keep using it... - Alex Czarto
(3) Don't even try to use Resharper if you do dev in a VM environment, unless your VM is running on an SSD.... - womp
16
[+9] [2009-06-03 15:07:55] opadilla

Try running your Windows machine using /3GB mode and making Visual Studio large address aware. Your IDE will have more RAM available to it and run much faster.

Refer to Hacking Visual Studio to use more than 2 gigabytes of memory [1] for reference and how-to.

[1] http://stevenharman.net/blog/archive/2008/04/29/hacking-visual-studio-to-use-more-than-2gigabytes-of-memory.aspx

(2) This is especially true with running Visual Studio 2010 on a 32-bit system, in conjunction with TFS, MSTest and a couple of other things. VS2010 is designed to keep the maximum virtual memory usage at about 1.6 GB, but if you're doing a lot of stuff, free memory in the process can get pretty fragmented, and eventually you hit a point where you can't even do basic operations like copy/paste anymore. - Warren
(1) Also, the /3GB switch is an XP thing... you need to use the BCDEDIT command-line tool on Vista and later. - Warren
17
[+8] [2008-08-28 02:54:25] Matt Dillard

If you are working with a team of developers, check out Incredibuild by Xoreax [1] (or as we used to refer to them, "Planet Xoreax"). It very seamlessly sets up distributed compilation in Visual Studio. I used this at a past place of employment and it cut our build times from 40 minutes down to around 7 minutes.

Getting Incredibuild set up truly changed the way I went about my work - I was actually able to get a streamlined code-compile-test cycle going.

[1] http://www.xoreax.com/main.htm

Note that the website says that this only works for C++ Visual Studio users. - Vaccano
18
[+6] [2008-09-05 02:09:45] Michael Prewecki

Using tokens in Tools -> Options -> Environment -> Task List will slow things considerably when you have lots of instances of a token and a large number of files.

Also with a large number of VB.NET projects background compilation can be a dog so there was a hotfix [1] for Visual Studio 2005 that increased performance.

[1] http://support.microsoft.com/kb/920805/en-us

19
[+6] [2008-09-06 18:56:09] Owen

@ lomaxx [1]: There's a way to track the active item only on demand [2].

I like this for at least a couple of reasons. One is that, especially in a big solution, working for a while with "track active item" turned on results in a large portion of the project tree being expanded, and thus a little hard to navigate.

[1] http://stackoverflow.com/questions/8440/#8498
[2] http://stackoverflow.com/questions/31163/forcing-the-solution-explorer-to-select-the-file-in-the-editor-in-visual-studio#46193

20
[+6] [2009-11-09 18:02:12] Bit Destroyer

Something that has saved me a few seconds here and there is a macro I found a while back that allows you to attach to the aspnet_wp.exe process for debugging. This way the IDE doesn't launch a new browser/tab every time you hit run or F5. This can be annoying if you're deep within a project and launching at the project start up page isn't beneficial. There are probably other ways to do this but binding the 'AttachToWebServer' macro below to a keyboard shortcut has served me well.

Public Sub AttachToWebServer()

	Dim AspNetWp As String = "aspnet_wp.exe"
	Dim W3WP As String = "w3wp.exe"

	If Not (AttachToProcess(AspNetWp)) Then
		If Not AttachToProcess(W3WP) Then
			System.Windows.Forms.MessageBox.Show(String.Format("Process {0} or {1} Cannot Be Found", AspNetWp, W3WP), "Attach To Web Server Macro")
		End If
	End If

End Sub

Public Function AttachToProcess(ByVal ProcessName As String) As Boolean

	Dim Processes As EnvDTE.Processes = DTE.Debugger.LocalProcesses
	Dim Process As EnvDTE.Process
	Dim ProcessFound As Boolean = False

	For Each Process In Processes
		If (Process.Name.Substring(Process.Name.LastIndexOf("\") + 1) = ProcessName) Then
			Process.Attach()
			ProcessFound = True
		End If
	Next

	AttachToProcess = ProcessFound

End Function

Also, the code highlighting above is dieing on the backslash in the LastIndexOf method but the code is accurate, pasted directly from my macro editor.


Calling this Macro on a breakpoint when hit and continue execution is a great way to save even more time! - Mike Atlas
Use Firefox to debug and you can reuse the existent tab... - Peter Gfader
21
[+5] [2008-08-12 03:59:39] Christian Hagelid

If you are using Visual Studio 2008 then I recommend downloading the newly released SP1.

Among other things it is meant to increase the speed of switching to design view - see Faster switch to design view in VS 2008 SP1 RTM [1].

Other updates: Web Development Updates in Visual Studio 2008 SP1 [2].

Sitecore [3] warning: Don’t Install .NET 3.5 Service Pack 1 on Sitecore Servers Yet [4]

[1] http://blogs.msdn.com/webdevtools/archive/2008/06/18/faster-switch-to-design-view-in-vs-2008-sp1-rtm.aspx
[2] http://blogs.msdn.com/webdevtools/archive/2008/08/11/web-development-updates-in-visual-studio-2008-sp1.aspx
[3] http://www.sitecore.net
[4] http://alexeyrusakov.com/sitecoreblog/2008/08/14/Donrsquot+Install+NET+35+Service+Pack+1+On+Sitecore+Servers+Yet.aspx

22
[+5] [2008-08-28 02:12:57] Jared Updike

To avoid large delays when you run a large Windows Forms [1] program in the debugger. Close all Visual Forms Designer tabs, quit Visual Studio, then run Visual Studio again and load your project. Loading the Designer at all (even if you close it again) can cause these weird large delays when your program runs in the debugger.

How I found this out: I have a rather large C# Windows Forms solution with dozens of projects that used to take forever to run when I hit F5 - even if I made only small changes and recompiled. Initially I thought it was due to the size of the solution, but I later noticed that the compilation was finishing quickly, but there was a still delay before the main form would load.

Later I found the same strange delay on another, new, smaller project and realized what I had in common: the Designer. Now I do all my design work in batches, and then close any Designer windows, quit Visual Studio, re-launch Visual Studio, and go back to coding.

[1] http://en.wikipedia.org/wiki/Windows_Forms

23
[+5] [2009-10-06 00:30:08] Andrew Medico

The main thing I've found is disabling the "Use Visual Studio hosting process" under Project Settings->Debugging for C# projects. This fixes the problem where (on some machines) Visual Studio will freeze up for 30+ seconds after a launched project terminates, instead of letting control return to the code editor immediately.


24
[+4] [2008-08-12 06:25:40] Biri

I'm a big fan of snippets; they really speed up the work. And as you all know, programmers are lazy even to type. :-)

Here are two snippet editors for VB.NET: for Visual Studio 2005 [1] and for Visual Studio 2008 [2]

And here is a very nice collection of snippets: for Visual Studio 2005 [3].

Have fun.

[1] http://msdn.microsoft.com/en-us/vbasic/ms789085.aspx
[2] http://msdn.microsoft.com/en-us/vbasic/bb973770.aspx
[3] http://msdn.microsoft.com/en-us/vstudio/aa718338.aspx

The first and third link is broken now. - Peter Mortensen
25
[+4] [2008-08-12 08:22:59] Greg Hewgill

One of the best ways to speed up a computer doing almost anything is to install more memory. You pretty much can't go wrong with that.


+1 Works especially well when compiling, linking and doing all sorts of disc access. Having all your source, dependencies, intermediate and output files in memory cache is teh win. - Macke
26
[+4] [2008-08-12 23:38:59] lomaxx

Another little performance boost I remembered this morning:

If you don't need XML Documentation, you can turn it off by right clicking in your project in solution explorer, selecting Properties -> Compile tab and uncheck the "Generate XML Documentation File" option


27
[+4] [2008-09-24 08:11:05] Charles Anderson

If you're using the Visual Assist add-in and Visual Studio starts getting really slow and using a lot of RAM, you could try deleting the folder C:\Documents and Settings\\Local Settings\Application Data\VisualAssist\vs8.

I've had to do this twice in two years of using Visual Assist, and both times it's had a dramatic effect on my speed. Visual Assist now has to reparse everything, but it does that in the background, so it's not much of a penalty.


28
[+4] [2009-07-31 15:36:15] Piotr Owsiak

I'd recommend moving your Visual Studio solution to a RAM drive. That speeded up my Visual Studio (especially operations like "Find in files" are lightning fast).

I would recommend either the free Gavotte RAM disk [1] or commercial product from QSoft.

I used Gavotte (which is quite fine) and now I'm running on QSoft (it can automatically save and load your RAM drive content on shutdown/startup and/or defined time/time-intervals).

BTW. QSoft prices start from 12$ (much less than their competition).

NOTE: I'm not a related to QSoft other than just being a happy customer :)

[1] http://www.jensscheffler.de/using-gavotte-ramdisk-in-windows-7

Use an SSD drive! - Peter Gfader
Aren't there ways to up Windows' cache, instead of needing to use a seperate RAM disk? - Mark
@Mark: I don't know, are there reliable ways to do that? I've heard that Windows won't take more than 1/8th of your RAM as disk cache (this does not apply to servers) even if there's plenty free. This is opposite to Linux that will take "all" your free RAM memory to cache disk operations. I wish there was such option in Windows. - Piotr Owsiak
@Peter Gfader: I'm sure you'll agree that SSD still is slower than RAM, right? However SSD will give you additional speed increase since assemblies/DLLs that you cannot move to ram drive will be loaded faster (i.e. your GAC, msbuils stuff, etc.). RAM drive will help you speed up operations on your solution like "Find in files", "Search and replace", build, etc. SSD will help you speed up VS launch time and your solution build time (which is also important i.e. when doing TDD). - Piotr Owsiak
Also if you're developing ASP.NET apps and run them on your local machine you will benefit from setting the TEMP directory to your ramdisk. ASP.NET compiler puts assemblies there (look for something like "Temporary ASP.NET Files" folder) - Piotr Owsiak
29
[+4] [2010-05-11 10:28:58] Oskar Duveborn

In Visual Studio 2010 - disabling GPU acceleration can make a huge difference in editor response/sluggishness even with workstation-class graphics cards (like older Nvidia Quadros).

This is also true of Adobe Photoshop CS4 and later - it seems to me the "detection" isn't exactly smart enough to evaluate the actual performance of the GPU before enabling it ^^


Is that a computer-wide setting or part of the individual app? - motto
An individual setting inside the application... these are rather new to both apps mentioned. - Oskar Duveborn
30
[+3] [2008-08-12 05:01:03] Ed S.

If you are using Visual Studio 2008, you can compile using the /MP flag to build a single project in parallel. I have read that this is also an undocumented feature in Visual Studio 2005, but have never tried myself.

You can build multiple projects in parallel by using the /M<maxprojects> flag, but this is usually already set to the number of available cores on the machine.

EDIT: I'm sorry, this is only for VC++ I believe, I should have read more carefully.


31
[+3] [2008-10-11 00:00:20] Robert C. Barth

The single biggest thing you can do to improve the speed of Visual Studio is to not use an integrated source code control system. All the checking it does to put the right icons in the solution tree takes FOREVER.


Ankh SVN is faster ! - Nicolas Dorier
VisualHG is fast too! - Macke
32
[+3] [2009-04-07 09:04:37] Pondidum

Disabling the splash screen seems (psychological?) to make Visual Studio load faster.

To disable it, modify the shortcut to "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe" -nosplash

A macro that replaces F1 with an open Firefox and Google for the selected word is nice too.


33
[+3] [2009-04-09 10:10:13] Kunal S

If you are using Windows Vista, change the theme to Windows standard, in short stop using the Aero [1] thing.

And I've observed on my system with Windows Vista business edition having 2 GB RAM on Core 2 Duo [2], that having Visual Studio, SQL Server Management Studio [3] and Outlook, all these three opened simultaneously had a major kick on performance.

If using Team Foundation Server [4], then keeping the Source control explorer always open in Visual Studio 2008 [5] too slows down Visual Studio. One can have a button to bring open the SCE window on a toolbar.

[1] http://en.wikipedia.org/wiki/Windows_Aero
[2] http://en.wikipedia.org/wiki/List_of_Intel_Core_2_microprocessors#Core_2_Duo_2
[3] http://en.wikipedia.org/wiki/SQL_Server_Management_Studio
[4] http://en.wikipedia.org/wiki/Team_Foundation_Server
[5] http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2008

34
[+2] [2008-09-18 12:38:16] ugasoft

I suggest the reading of "Visual Studio Hacks" by James Avery. There are a lot of hint to better use your favorite IDE ;)


35
[+2] [2009-05-01 14:45:55] YordanGeorgiev

Snippet Designer On CodePlex [1]

[1] http://snippetdesigner.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=21335

36
[+1] [2008-08-12 12:17:32] lomaxx

It may help installing more memory, but I've already got 4 GB RAM in my machine. However, I read a post from Scott Guthrie [1], Tip/Trick: Hard Drive Speed and Visual Studio Performance [2] a while back that said he installed a solid state drive in his laptop and got a nice speed boost.

[1] http://en.wikipedia.org/wiki/Scott_Guthrie
[2] http://weblogs.asp.net/scottgu/archive/2007/11/01/tip-trick-hard-drive-speed-and-visual-studio-performance.aspx

37
[+1] [2009-12-06 09:35:10] Iuliu Atudosiei
  1. IncrediBuild [1] is really amazing stuff. In my case, it reduced compilation time from 30 min to 7 min and computer is not frozen so you can do some other things in parallel.
  2. RAM disk if possible
  3. If you have two HDDs, put the source code and swap file on different drives.
[1] http://en.wikipedia.org/wiki/Xoreax_Grid_Engine#IncrediBuild

38
[+1] [2010-03-18 14:13:48] terryspitz

Use the magic C++ " Unity build [1]" technique... It's actually amazing: 20 min to 3 min minimum rebuild/link time for us.

[1] http://buffered.io/2007/12/10/the-magic-of-unity-builds/

39
[0] [2008-08-28 00:50:13] lomaxx

Ctrl + R, E will encapsulate a field (you have to have your cursor on the field). It's somewhat redundant in Visual Studio 2008 where you can have automatic properties, but it's excellent for Visual Studio 2005.


40
[0] [2008-09-30 18:50:32] Kristopher Johnson

A good list of Visual C++ tips is here: http://www.highprogrammer.com/alan/windev/visualstudio.html


41
[0] [2009-06-03 09:24:23] waqasahmed

Are you also referring to shortcut keys to speed up development time? If so, Alt + highlight with a left mouse click allows you to select a "box" of text. It is extremely useful.


nice tip, but i'm looking for things that will speed up the IDE - Tanner
why would that be useful? Code is still code and selecting it as whole lines is better simpler, more error prone... - Robert Koritnik
may not be as useful in VS coding, but certainly in the sql management studio when writing ur stored proc. - waqasahmed
42
[0] [2010-11-11 10:11:17] Robert Koritnik

Very useful batch (*.bat) file execution

Basically automating command line scripts execution. I usually write few database scripts that recreate the whole database of the project. These scripts are version controlled. I also use a batch file that runs all of these on my local database. Running this batch file within Visual Studio can easily be enabled by adding and additional editor for batch files.

Read the blog post Running batch files (*.bat) inside Visual Studio [1] where I explain the whole process step by step.

[1] http://erraticdev.blogspot.com/2010/11/running-batch-files-bat-from-within.html

43
[-2] [2009-11-09 17:33:07] rlb.usa

The very best optimization of all : Check for Visual Studio Updates


On so that you get something better when it comes, or off so that you don't waste time checking for it? - Daniel Daranas
I've often worked with VSS for a very long time and noticed X and Y were slow or not working well (costing me time) ... turns out there is a fix for it, it's in the updates. - rlb.usa
44
[-3] [2009-05-14 12:43:15] RC1140

I wrote a smallish post, Increasing your project's build efficiency [1], on increasing the load time on a larger project that some might find interesting get.

[1] http://runawaycoder.co.za/2009/05/14/increasing-your-projects-build-effeciency/

45
[-7] [2011-02-09 12:14:43] Dan Anos

A very obvious solution, but go to task manager and kill any processes that you don't need.

Here's my test: Standard build: 1.04 minutes "Only Build Startup and dependancies": 53 seconds build time "Selected projects only": 1.17 minutes build time "Killing unnessary processes": 4 seconds.

I'll repeat that; 1 min 4 seconds to 4 seconds by just killing processes you don't need! :)


(7) excuse me but this sounds like very bad advice. If you don’t need the programs, just close them (or shut them down if they are services). Don’t just kill processes. That’s confusing causation with correlation and reminds me of cargo cult programming. - Konrad Rudolph
46
[-10] [2009-04-07 08:23:15] Bigwave

A slightly philosophical answer, do less, KISS (Keep It Simple, Stupid)

Don't gold-plate your code, don't create a highly complex database driven framework if a simple class will do


(9) Nothing to do with the IDE. - Nick Bedford
47