[SDL] SDL under Mac OS X

Ryan C. Gordon icculus at clutteredmind.org
Sun Jan 23 05:02:39 PST 2005

> That wasn't my point at all. There's a difference between optimizing for 
> a processor, and compiling only for that processor. You can optimize the 
> scheduling and other such things for a specific CPU (Xcode can do this 
> for you, I believe.) Depending on your software project, supporting a G3 
> may be a total non-starter if the CPU reqs are above a certain level. So 
> scheduling for a G4 (to get optimal performance on the low end) at the 
> expense of small inefficiencies on the higher end machines (which won't 
> be noticed) makes sense.

In terms of high-end game development, it's not unreasonable to cut the 
G3 out at this point; Apple doesn't ship them anymore since the iBook 
went to the G4, and it's a real pain in some cases to conditionalize 
code based on the presence of a vector unit. Unlike MMX/SSE on x86 
chips, you can't use Altivec in a function that a G3 will enter, since 
the compiler adds setup code at the start of the function when it sees a 
vector variable/function. This means function call overhead and/or ugly 

Also, by 2006, I'll venture a guess that there'll be at least one 
commercial game shipping that's G5-only. Granted, Doom7 and Unreal22 
aren't necessarily representative of the game industry in that they can 
get away with culling the older hardware.

> Furthermore, -Os can be one of the best optimizations you can apply. The 
> more you can fit into your i-cache the better. Apple recommends all 
> shipping code be -Os. So unless you know for certain that these binaries 
> are built optimized for size, you shouldn't ship them.

For what it's worth, I think this is bunk. The CPU bottleneck is almost 
never the code cache, it's the data cache.

There was a time when Apple recommended -Os, but I think they've quietly 
stopped doing that with gcc 3.3. At least, I haven't heard it recently.

In my experience, -O3 is the sweet spot on MacOSX with gcc 3.3 (with 
-falign-loops=16, if you're writing tight loops like blitters).


More information about the SDL mailing list