Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /var/www/onemanmmo.com/include/social.inc.php on line 76
onemanmmo.com :: The One Man MMO Project :: The story of a lone developer's quest to build an online world
Twitter  Facebook  YouTube  E-Mail  RSS
The One Man MMO Project
The story of a lone developer's quest to build an online world :: MMO programming, design, and industry commentary
How I reduced my game's Build Time 85%
By Robert Basler on 2013-12-12 11:41:49
Homepage: www.onemanmmo.com email:one at onemanmmo dot com

For some time now I've suffered with abominable build times on my optimized builds. A full rebuild of just the client in Debug takes 160,825ms but in Release it takes 371,462ms. So for less code, that's a whopping 231% increase in build time just for optimization!

I build three different configurations of my game. Debug is a build with all debugging features enabled, ASSERT's on and debug trace output. Release has full optimization, no ASSERT's or trace output. I also have an Abort built which is fully optimized with ASSERT's and no trace output. I use the Abort build often, but the 6 minute build times even for a one-line change make it super-inconvenient to iterate.

My first experiment was to try Full Optimization instead of Optimize for Speed. That reduced the time to 364,315 or a 2% savings. Not really worth doing.

Next I tried changing Tools, Options, Maximum Concurrent C++ compilations to 8 (to match my CPU) which made no difference.

Then I discovered C++, General, Multi-Processor Compilation. Setting it to YES reduced the build time to 294,295 or a 21% reduction. Now we're getting somewhere. (Note this isn't compatible with incremental builds, so I don't use it on the debug build.)

As an experiment I turned off optimization entirely, that gave me 128,438. I turned off generation of debug info, which barely moved the clock (125,873.) I tried /OPT:NOICF which gave me 120,187 and /OPT:NOREF which gave me 125,364.

No optimization wasn't really an option, so instead I tried turning off Whole Program Optimization and /LTCG (Link Time Code Generation) while keeping optimize for speed. This gave me a time of 160,118 (a 57% improvement.) I also tried Full Optimization which gave me 157,716.

The last thing was to try Multi-Processor Compilation on with Whole Program Optimization and /LTCG off. That came in at a shockingly quick 54,188 (an 85% reduction in build time!) Originally my libs were build with /LTCG so I would get a warning in the output that the linker was turning /LTCG on. With that warning the build time was still greatly improved at 63,227.

Adding the Multi-Processor Compilation switch to my release build reduced its build time to 295,166 (a 21% improvement.)

Lessons learned:

Multi-Processor Compilation was off by default for me, this is a huge performance loss.

Whole Program Optimization and Link Time Code Generation account for 57% of the time for an optimized build. Use them only if you really need to.

By Robert Basler on 2013-12-12 13:18:14
Homepage: www.onemanmmo.com email:one at onemanmmo dot com
I tried moving the TMP folder for my solution to the second hard drive on my PC, that netted a 5s improvement in full build time.

The big change I forgot to mention though, is that a one file change for the abort build now takes only 10,406 to build which is an immense 97% reduction.

Also, the Abort build still runs at a steady 60fps which is my primary requirement of it.

New Comment

Cookie Warning

We were unable to retrieve our cookie from your web browser. If pressing F5 once to reload this page does not get rid of this message, please read this to learn more.

You will not be able to post until you resolve this problem.

Comment (You can use HTML, but please double-check web link URLs and HTML tags!)
Your Name
Homepage (optional, don't include http://)
Email (optional, but automatically spam protected so please do)
Type boy. (What's this?)

  Admin Log In

[Home] [Blog] [Video] [Shop] [Press Kit] [About]
Terms Of Use & Privacy Policy