[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: re:-O2 or -O3 ?



brian white writes ("re:-O2 or -O3 ? "):
> I'm surprised that [-O3] make a 20% increase in code size, especially for
> the probably negligible performance improvement.
>
> [...]
> The bottom line is, unless your function is _very_ short (a few lines,
> max, with no loops) in probably should _not_ be inline.  It sounds
> like the GCC "heuristic" does just this, but it probably isn't as good
> as a human could decide (with the "inline" directive).
> 
> I vote against using "-O3" and to stick with "-O2".

I'm confused.

We're building a distribution, so it makes sense to trade off
computation at build time against computation at run time.

I thought that the different -O<n> levels in GCC were different values
of that tradeoff; if so, then we should be using the highest
available.

If the different -O<n> levels have some other general scheme I'd like
to be enlightened as to what it is.

The GCC Info page is rather unhelpful on this point - it only tells
you what -f<optimise-like-foo> options each -O<n> turns on.  That
doesn't tell you what (for example) future compiler releases will
understand by -O<n> and what value you as a programmer (rather than a
compiler expert) ought to be using.

Ian.


Reply to: