0

There are many questions on SO about improving the build time in Visual Studio (cf. here, here, etc.), but the vast majority of answers are aimed at projects which are fairly large. Many of these answers (e.g. increasing amount of parallel builds) will only have a marginal effect on small projects, which is what motivates this question.

I am using Visual Studio Express 2015 with one solution, a single C++ project, containing only three files: an 800-line source file, and two .h files. I am running on Windows 7, my processor is Intel Core i5, CPU 2.60GHz, RAM 8GB.

My build time is a staggering 1 minute or more.

Based on suggestions in other SO threads, I have emptied my %temp% and prefetch directories, but this only had a marginal effect. I changed my code to remove as many warnings as possible. I removed all the unnecessary files from the VS directories for my project. My antivirus is disabled.

Here and here it was suggested that an SSD could help. I find it hard to believe, however, that my performance should be this poor with HDD.

I would be glad to hear any suggestions about this issue. Thank you in advance.

Community
  • 1
  • 1
atzol
  • 123
  • 2
  • 12
  • 1
    You understand it's impossible to even evaluate this question without code, right? – Michael Foukarakis Jun 26 '16 at 15:33
  • 1
    I would open task manager during the compile. See if even 1 core is at 100% CPU usage. Also look at the disk usage. – drescherjm Jun 26 '16 at 15:53
  • @MichaelFoukarakis My question is about the IDE, not my code. I cannot think of which parts of my code you would want to see--I obviously cannot post 800+ lines. The related questions which I linked do not include any code, so it didn't occur to me that my question should be a special case. I am simply asking for best practices to reduce build time. – atzol Jun 26 '16 at 15:56
  • @drescherjm Good point. It uses 25%, any thoughts? – atzol Jun 26 '16 at 15:59
  • 1
    ***Good point. It uses 25%, any thoughts?*** I expect that means 1 core of your quad core is 100% loaded. If this is the case the problem is not related to your hard drive. – drescherjm Jun 26 '16 at 16:07

1 Answers1

0

Some things you can do (not all may be relevant to your code):

Remove unneeded includes.

Build without optimization except for when doing release builds.

Use extern templates where possible.

Split your code into multiple source files so that only a subset of it needs recompilation when you make changes.

Use precompiled headers.

Jesper Juhl
  • 30,449
  • 3
  • 47
  • 70
  • Thank you. Could you please elaborate on building without optimization? – atzol Jun 26 '16 at 15:43
  • 1
    Building without optimization is the default for "Debug builds" in Visual Studio unless you've manually added options like `/O2` or similar. – Jesper Juhl Jun 27 '16 at 17:00