[SDL] SDL Performance once again
betasoft at acc.umu.se
Thu Sep 7 11:45:50 PDT 2006
On Thu, 7 Sep 2006, Maxim Mozgovoy wrote:
> I have read a couple of discussions on this topic but still haven't formed a
> consistent picture in my mind.
> The question is simple: suppose I initialize SDL, and perform a simple loop:
> Erase the whole screen
> Blit a background image
> Blit several sprites
> Pefrorm flip
In this case, erasing the screen is not needed and depending on how much
is covered by sprites SDL_UpdateRects may be faster than SDL_Flip.
> How many FPS should I get on a typical modern hardware (say, 1,5 GHz
> processor and a decent videocard; 1024*768*32b) under reasonable
> I know it depends on hardware/software surfaces, fullscreen/windowed mode,
> etc., but still? In my case it is usually 70-80 FPS, no more (while I
> expected at least 150).
Playing around with testblitspeed should answer most of those questions.
On X11 a quick back-of-the-envelope calculation gives around 100 FPS as
a teoretical max. In practice, you will never get there more than a few ms
at a time.
> One reply in the newsgroup was something like: "if you want to get speed
> in SDL, you should use OpenGL, otherwise you execute a generic
> cross-platform (slow) code". Is it really so? I mean if I want speed, I
> should forget about all SDL functions for blitting and about third-party
> routines for primitives (like SDL_prim), and begin to study OpenGL?
Or wait for SDL 1.3.
The problem with SDL 1.2 is that almost no blits is HW accelerated, while
in OpenGL most of them are.
More information about the SDL