Reasons why an SDL application would be slower in Windows?

I recently posted a message about compiling a Linux SDL application in
Windows. I’ve set up MingW32 and after some small fixes, I’ve managed
to get it recompiled!

Now, on to the performance problems. I notice that when running the
emulator under Linux, I get an average CPU usage of 3.5 - 4%, and a
maximum of 10% (I quite proud of that, actually :).

The exact same code in Windows uses 35 - 40%, and sometimes rises to
60%. I know Linux can be sometimes faster than Windows, but this seems
ridiculous.

I’m creating the surface using SDL_SWSURFACE, and using a dirty-update
scheme where I fill regions of the screen with SDL_FillRect (the
emulator is palette-based).

I tried switching to SDL_HWSURFACE | SDL_DOUBLEBUF in Windows, but
performance stays the same.

Does anyone know what the problem could be? I notice that in Windows,
even when the emulator is idling (paused and no new updates, just
blitting the same image to the screen at 60 fps, the CPU usage is still
30%. It doesn’t make sense.

Steve

Does anyone know what the problem could be? I notice that in Windows,
even when the emulator is idling (paused and no new updates, just
blitting the same image to the screen at 60 fps, the CPU usage is still
30%. It doesn’t make sense.

I’ve heard complaints that the DirectX input polling is causing high CPU
usage in otherwise idle applications, but I haven’t been able to figure
out why that would be, and nobody has had any suggestions.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment