Jump to content
  • Advertisement
Sign in to follow this  
RealMarkP

Speed up Compile Times

This topic is 3717 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm not sure if this is the right forum to post this, but I have a question regarding the compile time of my project. I'm using Visual Studio 2005 and I have the common settings turned on to speed up compile time (Incremental Building, etc). But as my project grows, its taking much longer to compile it and its becoming a burden. The project itself is about 260 Files, ranging from my own math/collision libraries, DX and OpenGL interfaces, and utilities. I was wondering, if anyone knows some neat tips or tricks to speed up compile time (anything short of using pre-compiled headers). Thanks for any suggestions.

Share this post


Link to post
Share on other sites
Advertisement
reduce dependencies, use interfaces, forward-declare in headers instead of include, use "pImpl" technique, avoid "master" headers... separate code into libraries so you only have to compile the libs you change... if you have lots of computers sitting around there's always incredibuild, or you can go multi-core on your personal machine.

why not use pre-compiled headers?

Share this post


Link to post
Share on other sites
If you're doing incremental build then you shouldn't build all of your code each time, unless you're doing rebuild all. Unless all your code are highly dependable on each other that one change would cause all to rebuild, which I highly doubted. I would use precompiled header, minimize dependency, break code into libs if possible. Other than that you can look at JAM.

Share this post


Link to post
Share on other sites
If you're using a multicore machine and coding in C++, you could always upgrade to MSVC 2008 and add the /Mp switch to the compiler. It parallelizes the compilation process. The difference in speed is significant.

Share this post


Link to post
Share on other sites
Another little tip that I've found useful is that you can compile just a single .cpp file without changing anything it affects by finding the file in the file browser (usually to the left), right-clicking on it, and selecting "Compile". It's great for simply checking syntax and that sort, where you don't plan on actually testing the changes, just making sure it compiles.

Share this post


Link to post
Share on other sites
The /MP switch also works for MSVC 2005. It is an 'undocumented' feature though, so it has some rough edges and does not work in all cases.

Share this post


Link to post
Share on other sites
Quote:
Original post by emeyex
reduce dependencies, [...] use "pImpl" technique.


I'm in the process of adding this in, thanks for the suggestion.

Quote:
Original post by emeyex
separate code into libraries so you only have to compile the libs you change...


I guess I can pull some Math code out into a Math library, but in its defense, its mostly inlined functions which are in the header itself. Would this be efficient?

Quote:
Original post by emeyex
why not use pre-compiled headers?


Its a lot of work IMO, I was going to leave it for headers that I no longer need to work on. Which might be a long ways away.

Quote:
Original post by Hnefi
you could always upgrade to MSVC 2008 and add the /Mp switch to the compiler. It parallelizes the compilation process. The difference in speed is significant.


I'll see about getting MSVC 2008 form my school. Does it matter which version you get (Express, or Professional, or anything in between?)

Quote:
Original post by Icon
The /MP switch also works for MSVC 2005. It is an 'undocumented' feature though, so it has some rough edges and does not work in all cases.


I tried this but it said the switch is unknown. Maybe I need to update my compiler (service pack) or just switch to MSVC2008.

Share this post


Link to post
Share on other sites
Quote:
Original post by RealMarkP
Quote:
Original post by emeyex
separate code into libraries so you only have to compile the libs you change...


I guess I can pull some Math code out into a Math library, but in its defense, its mostly inlined functions which are in the header itself. Would this be efficient?


What is that 'defending'? Extra code in headers means slower compile times.

Personally I think you'll find a lot can be done with simply reducing the size of your commonly-used headers, and culling dependencies.

Share this post


Link to post
Share on other sites
Quote:
Original post by RealMarkP
Quote:
Original post by emeyex
why not use pre-compiled headers?


Its a lot of work IMO, I was going to leave it for headers that I no longer need to work on. Which might be a long ways away.

Bzzt. It's not a lot of work, and it will be much more effective than anything else you're trying.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!