but really, large projects always take a long time to compile. You might go through hours of work to shave a few seconds off compile time.
but if you really want to do this, just "guess" which in-project header is included the most often, and start by shaving that down. It'll give you the most bang for your buck.
Thanks for the reply, and yeah, I wouldn't find it acceptable if I just said to myself "yeah, it's a large project, there's nothing I can do about it." I also don't plan on guessing anything, rather I need to develop a process that identifies the problem so I can solve it.
You might also need to be a bit more careful on how you structure your headers. A header that is included everywhere, will need to get recompiled, which will force the files that's included those headers to recompile. Luckily it won't go too deep. But it's a significant difference when you edit something like Unreals BaseObject class, then recompile it. Nearly 70% of the code base is dependent on that, that's 70% of the code base that needs to recompile.
Indeed. I think it's preferred to avoid this as much as possible.
In older projects, there is often a lot of obsolete #include.
We add #include lines when needed, but nobody warns us if it can be removed.
I know of someone that wrote a script that tries to take out each #include in turn, and then test if the code still compiles. If it does, it can obviously be removed smile.png
In particular, #include lines in header files can cost a lot of time.
Such a script could be a start to find candidate #include lines that may be removable.
Agreed. I really like this idea...and I'm going to add it as one of the solutions to explore.
Andy Firth wrote a series of blogs about his experiences in optimising the compile and link times at Bungie. Unfortunately, they were originally published on AltDevBlogADay, so they are very hard to track down:
I'll read all of these. Thanks.
If you have link-time code generation enabled in visual studio that can increase the link time by an order of magnitude in my experience. Disabling it (for all projects) made a big difference in my build time and didn't affect runtime performance much.
I'll try this, thank you.
Thanks for the replies, though I'd still like to be able to analyze each .obj (or any other generated file really as necessary) to find out what's costing me so much for link times.