Optimization flags in qmake.spec

Ryan Ware ryan.ware at gmail.com
Wed Jun 13 19:03:48 PDT 2007


I think part of what they on the Apple developer pages should be taken with
a grain of salt.  Yes, there can undoubtedly be times when -Os will produce
a sequence of instructions that are shorter and quicker than -O2.  The
second URL even shows an example.
That said, I believe the gcc folks would claim that the overall performance
of the majority of applications benefit from -O2 over -Os.  Not only that,
but they would say of performance is critical, do not rely on -O2 or -O3,
but to use -fprofile-arcs to instrument your code, run a representative work
load on the instrumented code and then re-compile with -fprofile-use.

Ryan


On 6/11/07, Daniel J. Luke <dluke at geeklair.net> wrote:
>
> On Jun 11, 2007, at 9:38 AM, Jochen Küpper wrote:
> > On 11.06.2007, at 11:02, Pierre Queinnec wrote:
> >> IIRC Apple recommends -Os, not -O2.
> >
> > Why?
> > Where is that documented?
>
> I've seen it elsewhere, but in this link, the "Fastest, smallest"
> Xcode setting corresponds to -Os
>
> http://developer.apple.com/documentation/Performance/Conceptual/
> CodeFootprint/Articles/CompilerOptions.html
>
> There's also discussion here:
>
> http://developer.apple.com/tools/gcc_overview.html
>
> Which mentions -
> "When in doubt, it may be better to optimize for size, since smaller
> code may execute relatively faster. For example, large functions or
> loops containing data access patterns that do not exhibit a strong
> locality of reference may not fit into a processor's cache lines,
> which can lead to cache misses and subsequent fetches from memory.
> Smaller functions or loops with local data access stand a better
> chance of fitting in a given cache line and requiring fewer memory
> accesses."
>
>
> --
> Daniel J. Luke
> +========================================================+
> | *---------------- dluke at geeklair.net ----------------* |
> | *-------------- http://www.geeklair.net -------------* |
> +========================================================+
> |   Opinions expressed are mine and do not necessarily   |
> |          reflect the opinions of my employer.          |
> +========================================================+
>
>
>
> _______________________________________________
> macports-users mailing list
> macports-users at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/macports-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-users/attachments/20070613/db7c67d7/attachment.html


More information about the macports-users mailing list