Re: -O3 vs. -Os
Re: -O3 vs. -Os
- Subject: Re: -O3 vs. -Os
- From: Steve Checkoway <email@hidden>
- Date: Tue, 17 Jan 2006 11:54:02 -0800
On Jan 17, 2006, at 10:12 AM, Scott Fraser wrote:
On Jan 17, 2006, at 04:56 AM, Steve Checkoway wrote:
Second, on what do you base that assertion? The idea that smaller
code is faster makes perfect sense when you think about it from a
cache point of view. Turning off optimizations and making the code
larger at the same time doesn't seem likely to improve performance.
In general, if you're app doesn't spend much time in any given
function, smaller code is better. "Regular" apps, particularly
object-oriented apps written C++, Java, and Objective-C, will have
lots of little functions, and no single function takes much time.
Optimizing those for speed doesn't help much. But if you have
larger functions with lots of loops (or large loops) where lots of
time it spent, it might make sense for the compiler to unroll those
loops.
With object-oriented languages, you get much more bang for your
buck by changing your algorithms to make fewer function calls than
by tweaking the compiler settings.
Because OO languages often have accessors, for any given algorithm,
they are likely to call more functions than say, C. Yet with higher
optimization, the compiler can inline most of those small-function
calls, especially accessors.
Actually, small loops benefit the most from loop unrolling because it
is harder for the processor to find instruction level parallelism in
small basic blocks. By unrolling the loops, the compiler can create
larger basic blocks with more freedom to schedule instructions
(either statically or dynamically).
- Steve
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden