Reputation: 1163
What flags for either gcc or clang will improve compile times? I require debugging to be enabled but any other features are free to be disabled if they will result in faster compiles.
I know there are numerous other ways to improve compile times but I am interested soley in this area.
Upvotes: 6
Views: 7214
Reputation: 7814
As for GCC, you can try multithreaded compilation (-jX flag, where X is a number of cores you have +1, according to Reducing compile times article in the Qt Centre).
UPDATE: It seems that I made a mistake: -jX is a 'make' flag, not GCC. So it will improve linking times if you use make-based build system.
Upvotes: 2
Reputation: 8650
If we start with our base line as 'compiling with no flags' there are no flags you can set that will increase the compilation time.
Upvotes: -4
Reputation: 30128
Try -O1, despite it being counter intuitive afaik it can speed up compilation compared to -O0. Also check out ccache
Upvotes: 3
Reputation: 994301
The largest gain in compile time is found by eliminating the most work done by the compiler - usually optimisation. So, don't enable optimisation (-O
) flags.
Upvotes: 7