user162445
user162445

Reputation:

I want to reduce my VS.NET project's compile time - what are your ideas for how to do this?

My project is developed in Visual Studio 08, in C#. It's a standalone desktop application, about 60k lines of code. Once upon a time I loved working on this software - now that the compliation time has grown to approx 2 minutes, it becomes a far less enjoyable experience...

I think that my lack of experience in C# may be a factor; I have developed everything under one namespace for example - would having a well structured codebase enable the compiler to recompile only the necessary parts of the code when changes are made? Or do I need to separate sections into separate projects/DLLs to force this to happen?

How much of a difference would upgrading to the latest quad-core processor make?

The other thought is, perhaps this is a typical thing for programmers to deal with - is a long compile time like this simply something that must be managed?

Upvotes: 7

Views: 5832

Answers (4)

Brad Patton
Brad Patton

Reputation: 4205

There is this thread about hardware to improve compile time. Also this really excellent blog post from Scott Guthrie on looking at hard drive speed for performance.

Upvotes: 1

Nader Shirazie
Nader Shirazie

Reputation: 10776

Splitting your project up into multiple projects will help. Only those projects that have changes (and projects that depend on it) will need recompilation.

A single namespace however, shouldn't affect compile time. However, if you do split up your project into multiple projects/assemblies, then a single namespace is definitely not a good idea.

Upgrading to a faster CPU will probably help, but you might find that faster I/O (better disks, RAID, etc will be more useful).

And yes, avoiding long compile times are one of the things developers need to take care of. When it comes to productivity, do whatever you can (better tools, bigger screens, faster machines, etc...)

Upvotes: 0

Sam Harwell
Sam Harwell

Reputation: 99989

Things that increase compile time:

  • The number of projects in a solution makes more difference than the number of files in a particular project.
  • Custom build tasks can make a huge difference, especially if they are generating code or running post-build analysis (FxCop, StyleCop, Code Contracts).
  • Native code projects take longer to build.

A single project containing 60K lines of C# code with no special build features enabled should compile in seconds on any machine made in the past 5+ years.

Upvotes: 11

jrista
jrista

Reputation: 33010

I'm surprised that 60k lines of code take 2 minutes to compile. I have an application that is 500,000 lines of code, and it only takes about a minute and a half. Make sure you are not doing full rebuilds each time, and make sure you are not cleaning the solution between builds. A normal build should perform an incremental build, only recompiling code that has changed since the last build (along with anything affected by that change.)

Perhaps some other factors might include heavy use of large resources (images?), broad-sweeping changes in the lowest level libraries (i.e. those used by everything else), etc. Generally speaking, on a relatively modern machine, compiling 60,000 lines of C# code should take less than a minute on average, unless you are rebuilding the entire solution.

Upvotes: 4

Related Questions