Hi everybody
A lot of people wonder how SFML compares to SDL, that's why I wrote a small benchmark to compare a few key features, mainly displaying sprites and text.
The tests consists of counting the number of frames rendered during 5 seconds :
1/ Displaying 2000
static sprites2/ Displaying 2000
alpha-blended static sprites3/ Displaying 2000
rotating sprites4/ Displaying 20 lines of
static text5/ Displaying 20 lines of
dynamic textI used SDL_gfx for sprites rotations and SDL_ttf for displaying text. The latest versions of these libraries, as well as SDL, were used.
Source code + binaries + images + VS2005 files can be downloaded here :
http://sfml.sourceforge.net/temp/bench-sdl-sfml.zip (1.15 Mo)
Here are the results on a high configuration (AMD Athlon 64 DualCore 3800+, GeForce 7800 GT, 1 Go de RAM, Windows XP) :
1/ Test : sprites
SDL displayed 9 frames
SFML displayed 303 frames
--> SFML is 3366% faster than SDL
2/ Test : alpha-blended sprites
SDL displayed 5 frames
SFML displayed 216 frames
--> SFML is 4320% faster than SDL
3/ Test : rotating sprites
SDL displayed 3 frames
SFML displayed 277 frames
--> SFML is 9233% faster than SDL
4/ Test : static text
SDL displayed 416 frames
SFML displayed 6092 frames
--> SFML is 1464% faster than SDL
5/ Test : dynamic text
SDL displayed 363 frames
SFML displayed 948 frames
--> SFML is 261% faster than SDL
Results on Linux with the same config are similar (a bit better for SFML).
Here are the results on a low configuration (Intel Pentium M 1.73 Ghz, integrated GPU Intel 915GM, 256 Mo de RAM, Windows XP) :
1/ Test : sprites
SDL displayed 8 frames
SFML displayed 21 frames
--> SFML is 262% faster than SDL
2/ Test : alpha-blended sprites
SDL displayed 5 frames
SFML displayed 21 frames
--> SFML is 420% faster than SDL
3/ Test : rotating sprites
SDL displayed 2 frames
SFML displayed 15 frames
--> SFML is 750% faster than SDL
4/ Test : static text
SDL displayed 885 frames
SFML displayed 774 frames
--> SFML is 13% slower than SDL
5/ Test : dynamic text
SDL displayed 628 frames
SFML displayed 797 frames
--> SFML is 126% faster than SDL
As you can see SFML is faster than SDL, and it has to do with the use of OpenGL for getting hardware acceleration. Moreover, the 2D part of SFML has not been heavily optimized, and could be faster if needed.
If you have any question or suggestion about this benchmark, or any idea for something else to compare, feel free to discuss it here.