Reducing compilation memory usage
Andrew Haley
aph@redhat.com
Sun Jan 20 18:35:00 GMT 2008
Tony Wetmore wrote:
> Alejandro Pulver wrote:
> >> RAM! Of course we could make gcc more economical, and
> >> we could somewhat reduce memory usage, but you're asking
> >> for something really hard.
> >
> > I wasn't asking to change the program, I was just asking
> > if there is an already existing option.
>
> I think Andrew may have meant that you are asking GCC to do something
> really hard, to optimize a single function that is so large. And asking
> the compiler to do something that hard has a price -- it requires lots
> of memory, as you have discovered.
I was saying exactly that, thank you for clarifying.
The thing to realize is that it is really hard to do a great job of optimizing
huge functions. So, it's quite likely that gcc will do a better job of
optimizing a bunch of small functions, with well-contained locality of variables,
than one huge function.
OK, so you will have the overhead of a function call. But on most architectures
that isn't enormous.
Andrew.
More information about the Gcc-help
mailing list