Jan 27, 2014

A closer look into slow Visual Studio start-up

Did your Visual Studio take forever to start ? Take a deep look into the root cause:

  • Root cause #1: a slow hard-drive.

Observation: A normal 7200rpm HDD is considered slow to work with a project with thousands of files. Upon load the solution, Visual Studio do lots of I/O check and file content lookup (.suo, .xml, .csproj). Some plugin and add-on such as Resharper even do cache reload (see video), thus increasing the disk I/O.

Solution: switch to SSD. A recent SSD SATA3 cost around $200 for 240GB – enough for OS & your source code.

  • Root cause #2: too many plug-in, add-on and extensions.


    Observation: You’ll notice how blazing fast it is if you start your Visual Studio in Safe Mode ( Start –> Run:  devenv.exe /safemode or right click Visual Studio icon and choose Safe Mode.)

    image

Solution: disable the add-on & extensions you don’t need (or the ones that took longest time to start).
Step-by-step:

1. Start –> Run, enter :

Devenv /log C:\vslog.xml
It will start Visual Studio in Diagnostics mode, and output the log to C:\vslog.xml

2. Copy this file (link or Git) to C:\ , then open C:\vslog.xml using Internet Explorer
You’ll have this pre-formatted nice view: take a look at the hotspot






Notes: the XSL is not mine, credit to this guy 




  • Root cause 3: Antivirus running in the background



Observation: Antivirus programs are known for their intensive disk usage and they can clog to the hard drive, especially when your programs generate a lot of files (I bet the AV detects it and start scanning the generated files)


Solution: Temporarily disable your antivirus program (if not needed). For me, disabling AVG improve the load time by at least 1.5s-2s.

No comments:

Post a Comment