Tips to compile very very giant code

Bento Borges Schirmer bbschirmer@inf.ufsm.br
Fri Feb 14 19:51:29 GMT 2025


Dear Florian,

I am profoundly grateful for your precise answer, as I can now focus
on my thesis peacefully.

For my new 7.2 MB 328963-lines-long C file:

clang -c -O0: 23s, 34 MB
gcc -c -O0: 1m8s, 31 MB
clang -c -Oz: 1m59s, 23 MB
gcc -c -Oz: 4m23s, 23 MB

https://github.com/bottle2/swf2c/blob/085de13eb535a90b3c2a8b2f200bda00d8671102/there_she_is.c

Best regards,
Bento

Em qua., 12 de fev. de 2025 às 05:25, Florian Weimer
<fweimer@redhat.com> escreveu:
>
> * Bento Borges Schirmer:
>
> > [3] https://github.com/bottle2/swf2c/blob/88f9ccb7912d55002e87f1efb11f21720d97e4ec/tests/thousands-of-functions.c
>
> You should turn L and B into proper functions instead of macros, then
> compilation time will decrease significantly.  If compilation time is
> still too high, consider adopting a table-based approach.
>
> > [4] https://github.com/bottle2/swf2c/blob/c4e4faaa50fda0876fa877e68f50de2c6291a7c2/tests/gigaenormous-function.c
>
> Similar changes as above.  The OpenMP sections should probably be
> separate functions.  Maybe store their addresses in an array and invoke
> them from an OpenMP parallel loop.
>
> Thanks,
> Florian
>


More information about the Gcc-help mailing list