This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: reduce compilation times?
Hi NightStrike,
> Is there a difference in the speed of the resulting program when everything is split into many object files instead of being combined into a single main.c ...?
There may be a negative small performance impact in a resulting program that is split into many object files instead of being combined into a single main.c. (My expectation is that, overall, the performance impact will be negligible if it is even measurable.)
There may be a few interoperating routines that are strongly negatively impacted by being split into many object files instead of being combined into a single object file. (My expectation for these particular routines is that they should be heavily optimized, perhaps even being rewritten in lovingly handcrafted assembly -- assuming assembly chops are superior to the optimizing compiler's amazing optimizations.) If not re-written in hand coded assembly, at least having performance critical routines' code hand-tweaked to allow the GCC optimizer to do it's best to optimize it would be prudent (including using inline functions, and avoiding the anti-patterns that cripple optimization).
The way to assess those routines is through profiling.
GCC does not do "holistic" optimizations (yet). In contrast, LLVM does "holistic" optimizations.
>... or is the resulting binary identical bit for bit?
No, the resulting binary is not identical bit-for-bit.
It should be identical output for identical input. (Barring non-compliant or undefined behavior code, of course.)
HTH,
--Eljay