And in the end after compilation there will be a file named yourproject_comb.c
stevefan1999
Unreal Engine also do something called a Unity build (the irony) which also put multiple cpp files in one big file by using #include
show comments
rtpg
Xonsh, a Python-based shell, used to do this for startup speed reasons, but got rid of it on account of stack traces being a mess afterwards.
matheusmoreira
> And because all code is in a single translation unit, compilers can do better inter-procedure and inlining optimization resulting in machine code that is between 5% and 10% faster.
It's weird that this is still true even though compilers are now capable of whole program optimization at link time. Enabling LTO should be equivalent to compiling everything as a single translation unit but apparently it isn't. I wonder what exactly inhibits the aforementioned inter-procedural and code inlining optimizations in LTO builds.
FWIW it's possible to amalgamate almost any C program automatically with the help of https://github.com/goblint/cil (a maintained fork of CIL): https://goblint.github.io/cil/merger.html
All you have to do is to make your CC this:
cilly --noPrintLn --merge --keepmerged
And in the end after compilation there will be a file named yourproject_comb.c
Unreal Engine also do something called a Unity build (the irony) which also put multiple cpp files in one big file by using #include
Xonsh, a Python-based shell, used to do this for startup speed reasons, but got rid of it on account of stack traces being a mess afterwards.
> And because all code is in a single translation unit, compilers can do better inter-procedure and inlining optimization resulting in machine code that is between 5% and 10% faster.
It's weird that this is still true even though compilers are now capable of whole program optimization at link time. Enabling LTO should be equivalent to compiling everything as a single translation unit but apparently it isn't. I wonder what exactly inhibits the aforementioned inter-procedural and code inlining optimizations in LTO builds.
This appears to be a hand-rolled Unity build..