Reputation: 4057
I'm wondering how visual studio handles compiling a solution that is split up into sub projects, compared with a solution with just one project (with the same amount of classes for example say 200 classes). Which would compile faster (or would they both be the same)?
Upvotes: 0
Views: 5342
Reputation: 186
I think it's faster by compiling a solution split uf into sub projects. If you didn't change one of the other projects, it could use the already compiled dll of the unchanged sub-projects. If all classes are located in one project, you'll have to compile the whole project everytime you build...
But more important than the building speed is in my opinion the architectural advantage of splitting your solution into sub-projects. If you have several components which could be used as standalone program or as library in another solution, it totally makes sense to split your project. This would be my approach to split a solution into sub-projects! The compilation speed is just a positive side effect of this.
check out this link for optimizing building speed: http://blogs.microsoft.co.il/blogs/arik/archive/2011/05/17/speed-up-visual-studio-builds.aspx
one more advantage you have in splitting a solution in several projects: the compiler is able to compile in parallel - even if there are some dependencies between these projects. So all in all it will be faster, i'd say.
Upvotes: 1
Reputation: 179779
Hard to answer in general - it depends on many factors, including VS version. Precompiled headers might or might not be shared; whole-program optimization is really whole-link-unit optimization; linking DLLs happens at runtime and therefore doesn't count against Visual Studio build times, etc.
Upvotes: 0