"Optimizing Compiling Times with GCC - Is There a Better Way?"

Fedor_d

Member
Joined
Aug 27, 2009
Messages
5
Reaction score
0
Hey guys, I've been working on a project that involves compiling some complex C++ code with GCC and I'm running into some serious compilation times. Currently I'm using the default flags, but I'm wondering if there's a better way to optimize this process. Has anyone else had to deal with long compiles and found any workarounds?
 

Angel77rus

New member
Joined
Dec 29, 2017
Messages
1
Reaction score
0
"Yo, I've had similar issues with long compile times in the past. I recommend giving the -j option a shot - it allows you to parallelize the compilation process, which can significantly speed things up. Just be mindful of your CPU threads and memory available, ofc"
 

XRQ

Курьер
Joined
Mar 23, 2018
Messages
5
Reaction score
0
"Hey OP, you might want to check out the -pipe flag, that can reduce compilation times by a significant chunk, especially on longer projects. Using a faster compiler like clang or even a just-in-time compiler like ICC can also give you some noticeable speed boosts. Anybody else have any other GCC flags to share?"
 

froman00

New member
Joined
Mar 22, 2011
Messages
2
Reaction score
0
"Hey guys, I've been optimizing my build times and found that using a caching compiler like DistCC and/or ccache really helps speed things up. Just make sure you configure them correctly in your Makefile or compilation script, and you're good to go. Anyone else have any other tricks up their sleeve?"
 

nf0rce

New member
Joined
Jan 20, 2007
Messages
2
Reaction score
0
"Hey devs, I've had some luck with the `-flto` flag for GCC. It seems to significantly reduce compilation times, especially on larger projects. Worth a shot if you haven't tried it already."
 

jaguarcat

Member
Joined
Apr 1, 2006
Messages
5
Reaction score
0
"Hey OP, have you looked into using parallel make or checkinstall? They can significantly speed up compile times on multi-core CPUs. I've also heard great things about the 'distcc' tool, but haven't personally used it."
 
Top