<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 11, 2013 at 12:31 PM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank" class="cremed">hfinkel@anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">> I think assuming that these optimizations are ordered in some way<br>
> based on "fast" is wrong. For *many* C++ codebases -O2 produces<br>
> consistently higher quality code than -O3.<br>
<br>
</div>What does *many* mean? Even a small percentage of the total can be a lot in absolute magnitude. -O3 should produce faster code than -O2, on average, and if that is not true, then we have a serious problem (and the test suite should do more -O2 testing).<br>
</blockquote><div><br></div><div>-O3 will trade off code size in the hope of getting more performance. Applications where that tradeoff doesn't pay off don't benefit from it. Typically, more loop-heavy or numerics heavy applications tend to benefit. More generic, or "application"-y code tends to run better with -O2.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Also, this might depend on the platform. Embedded cores might benefit much more from -O3 than fancy out-of-order desktop chips.<br></blockquote><div><br></div><div>Yes, I would expect embedded cores to benefit more, and the code workloads run on those cores to also benefit more. Fast out-of-order chips (desktop or phone or tablet) tend to like small code more, and tend to perform better at -O2.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Can you please explain further?</blockquote></div><br>Sorry if I'm still being vague. It's vague. This is based on my experience both benchmarking lots of my own software (personal and at work) and based on listening to lots of others doing the same. I think this is somewhat OK because we're just trying to pick a "default" or a "fallback". I just don't think -O3 is the most sensible.</div>
</div>