views:

99

answers:

1

I read some of the questions about precompiled headers but couldn't find a direct answer to that.

I usually rebuild my entire Visual Studio 2010 solution.

One of the projects in my solution is a C++/CLI project.

I thought that using precompiled headers in that project will increase the speed of the compilation.

After some experiments, it seems that using precompiled headers only slows the rebuild process.

Do precompiled headers only help with builds that didn't completely clean the old files?

EDIT:

For example, let's say my StdAfx.h has only 1 line:

#include <string>
+3  A: 

It depends!

For Rebuilds, it's a trade-off between the extra cost of compiling the precompiled header and the speed-up from not having to re-parse those headers for each of your sources.

If you have many source files that use many of the same headers in your precompiled header, you should see a benefit. Otherwise, you should see almost no speed-up, or worse, a slow-down due to the overhead of carrying around a monolithic set of headers and a crowded global namespace.

Inverse
I've never seen a slow-down. But I think it can be in some specific situations.
Sergius