[macos 10.5, Intel, SDL 1.2.15] General system slowdown

I’m porting a freeware game from win32/directx to macos/sdl/opengl. The game itself is working fine, now.
The problem is that the system outside the game becomes very sluggish, with the UI for other apps taking ages to respond, and massive slowdown/stalls during load. Top reports the cpu usage of the game as ~30% for the debug build, and ~15% for the release build. And for some reason the slowdown is much stronger on my Intel MacBook than on my ancient PowerPC Mac Mini. The app and all libraries are built universal, so it shouldn’t go through the binary translator. Both my MacBook and the Mac Mini run MacOS 10.5.
I already followed the common suggestion to insert a small SDL_Delay into the main loop(s) to give the scheduler a chance to give time slices to other threads, but that didn’t make much of a difference. I have the feeling that it is something silly like not pumping OS events fast enough, though I’m not sure what I can do to improve that.
The game uses FMOD for audio, so I used FMOD for MacOS in the port as well. If I break into the debugger when I get the biggest stalls it seems to be busy with an audio load. Maybe the whole problem is in FMOD or the audio device driver, and not in SDL at all.
Has anyone experienced similar problems on MacOS, or has some suggestions what I can look into to improve system performance?

Run Shark or Instruments on your app and find out where your time is
being spent in your app.On 2/22/12, JensChR <jens.restemeier at gmail.com> wrote:

I’m porting a freeware game from win32/directx to macos/sdl/opengl. The game
itself is working fine, now.
The problem is that the system outside the game becomes very sluggish, with
the UI for other apps taking ages to respond, and massive slowdown/stalls
during load. Top reports the cpu usage of the game as ~30% for the debug
build, and ~15% for the release build. And for some reason the slowdown is
much stronger on my Intel MacBook than on my ancient PowerPC Mac Mini. The
app and all libraries are built universal, so it shouldn’t go through the
binary translator. Both my MacBook and the Mac Mini run MacOS 10.5.
I already followed the common suggestion to insert a small SDL_Delay into
the main loop(s) to give the scheduler a chance to give time slices to other
threads, but that didn’t make much of a difference. I have the feeling that
it is something silly like not pumping OS events fast enough, though I’m not
sure what I can do to improve that.
The game uses FMOD for audio, so I used FMOD for MacOS in the port as well.
If I break into the debugger when I get the biggest stalls it seems to be
busy with an audio load. Maybe the whole problem is in FMOD or the audio
device driver, and not in SDL at all.
Has anyone experienced similar problems on MacOS, or has some suggestions
what I can look into to improve system performance?


Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

Eric Wing wrote:

Run Shark or Instruments on your app and find out where your time is
being spent in your app.

There wasn’t anything really standing out… I found a busy-wait for a fixed timespan, but that didn’t seem to be the root of the problem. Especially weird is that it runs better on the slower computer (even if you consider the power/clockrate ratio is higher on PowerPC than on Intel.)
I have a hunch that it may be related to the audio code. I could disable it, but some of the game’s logic is waiting for sounds to complete. Maybe I’ll just port it to SDL_Mixer to see if it makes a difference.