This question is perhaps somehow odd, but how can I speed up g++ compile time? My C++ code heavily uses boost and templates. I already moved as much as possible out of the h
If there are a lot of files you can speed up compilation a lot by just having one .cpp file that #includes all the other .cpp files. This of course requires you to be more careful with macros and such that you already have defined per file as they will now be visible to other cpp files.
If there are many files this can reduce compile time a lot.
Here's what I've done to speed up builds under a very similar scenario that you describe (boost, templates, gcc)
If you're doing a lot of recompilation, ccache might help. It doesn't actually speed up the compilation, but it will give you a cached result if you happen to do a useless recompilation for some reason. It might give an impression of tackling the wrong problem, but sometimes the rebuilding rules are so complicated that you actually do end up with the same compilation step during a new build.
Additional idea: if your code compiles with clang, use it instead. It's usually faster than gcc.
What has been most useful for me:
-j3
globally for make. Make sure your dependency graphs are correct in your Makefile, though, or you may have problems.-O0
if you're not testing execution speed or code size (and your computer is fast enough for you not to care much about the (probably small) performance hit).