Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Benchmark : SDL vs SFML  (Read 168051 times)

0 Members and 1 Guest are viewing this topic.

workmad3

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Benchmark : SDL vs SFML
« Reply #15 on: May 14, 2008, 04:17:24 pm »
It's also worth noting that SDL is also frequently used as a 2d API without any OpenGL functionality (I know of several indy games that do just that).

What would really be interesting is comparing how much work you would need to do in SDL to either get the same raw speed out of the 2d software API or produce the same results as you can get easily in SFML. Raw speed comparisons are rarely as useful as productivity comparisons due to moores law and other such technology trends increasing the base speed :)

Kernelpanic

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • http://eisenholz.bplaced.net
Benchmark : SDL vs SFML
« Reply #16 on: May 17, 2008, 10:28:48 pm »
Hey, how to compile this benchmark with g++/gcc?
I get only Compiler-Errors.
When I add #include s in main.cpp I can use some of the functions but not all of them.

Stonefish

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Benchmark : SDL vs SFML
« Reply #17 on: September 10, 2008, 05:35:30 pm »
I have made some optimization of SDL code by adding SDL_DisplayFormat() calls after image loading:
Quote

for( int i = 0; i < 5; ++i ) Images = SDL_DisplayFormat(Images);

After that I have very interesting results:
Quote

1/ Test : sprites
SDL  displayed 35 frames
SFML displayed 32 frames
--> SFML is 91% faster than SDL

2/ Test : alpha-blended sprites
SDL  displayed 25 frames
SFML displayed 31 frames
--> SFML is 124% faster than SDL

As you can see sprites drawing without alpha using SDL is faster then using SFML.

Wizzard

  • Full Member
  • ***
  • Posts: 213
    • View Profile
Benchmark : SDL vs SFML
« Reply #18 on: September 10, 2008, 07:12:58 pm »
Quote from: "Stonefish"
As you can see sprites drawing without alpha using SDL is faster then using SFML.

This highly depends on the system you test with.
If you have a simply wonderful CPU and an utterly horrible GPU, SDL will likely run faster.
In general, computers, especially newer ones, should run SFML much faster than SDL.
However, I think this whole thing is rigged anyways.
SDL nor SFML should be judged based on their performance,
because they both support the use of OpenGL,
and everybody should be using OpenGL if their application needs performance.

Stonefish

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Benchmark : SDL vs SFML
« Reply #19 on: September 11, 2008, 09:47:44 am »
Quote from: "Wizzard"
This highly depends on the system you test with.


I think you don not understand me.
I simply wanted to say that your SDL test is not correct.
I perform the test with and without  SDL_DisplayFormat() on ONE computer. SDL test without SDL_DisplayFormat() was MUCH slower then SFML.

My hardware:
Quote

AMD Athlon X2 3800+  
GeForce 6100
Windows XP


As I see in SDL documentation SDL_DisplayFormat() is necessary to optimize bitmap blitting and that function call is recommended in all SDL tutorials.

I did not test sprite rotation and test drawing, but I think that sprite rotation will be slower in SDL even with my optimization because  SDL_gfx rotate image using CPU not GPU.

I like SFML more than SDL, but I think you have to change your SDL test code to show more truthful results.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Benchmark : SDL vs SFML
« Reply #20 on: September 11, 2008, 10:09:00 am »
You're right, the SDL results for static sprites are much better with this optimization (5x faster -- althought it's still 10x slower than SFML on my computer). For rotating sprites and text however it's not worth it (text doesn't even render at all).

But this benchmark is not only for comparing speed, it's also to compare programming interfaces; and I'm glad to see that SDL is even more complicated to use properly :mrgreen:
Laurent Gomila - SFML developer

dunce

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Benchmark : SDL vs SFML
« Reply #21 on: September 15, 2008, 05:58:25 am »
Quote from: "Stonefish"
I have made some optimization of SDL code by adding SDL_DisplayFormat() calls after image loading:
Quote

for( int i = 0; i < 5; ++i ) Images = SDL_DisplayFormat(Images);

After that I have very interesting results:
Quote

1/ Test : sprites
SDL  displayed 35 frames
SFML displayed 32 frames
--> SFML is 91% faster than SDL

2/ Test : alpha-blended sprites
SDL  displayed 25 frames
SFML displayed 31 frames
--> SFML is 124% faster than SDL

As you can see sprites drawing without alpha using SDL is faster then using SFML.


91% and 124% both are wrong evaluations.

Correct evaluations should be:

1. delta = ((32 - 35) / 32) * 100; delta = -9.375%; SFML is slower.
2. delta = ((31 - 25) / 31) * 100; delta = 19.35%; SFML is faster.

eleinvisible

  • Newbie
  • *
  • Posts: 47
    • View Profile
Benchmark : SDL vs SFML
« Reply #22 on: September 20, 2008, 01:34:03 am »
Quote from: "Stonefish"

As you can see sprites drawing without alpha using SDL is faster then using SFML.
Ah yes... well, SFML doesn't use many OpenGL accelerations from what I have seen (or even DXT compression?), so such conclusions are premature considering SFML's age when compared to SDL.

heishe

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Benchmark : SDL vs SFML
« Reply #23 on: September 22, 2008, 08:06:08 pm »
you can still compare sdl to sfml. both are wrappers (sfml starting to lean towards the 2d engine area).

you could argue that sdl with opengl would at least be just as fast, but using sdl + opengl is nothing different from just using pure opengl. you just use sdl for creating the window and handling events anyways.

plus if you use sdl + opengl you don't automatically get this nice oop layout that sfml has.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Benchmark : SDL vs SFML
« Reply #24 on: September 22, 2008, 08:34:49 pm »
Quote from: "heishe"
plus if you use sdl + opengl you don't automatically get this nice oop layout that sfml has.

How do you handle events with SDL and without a loop ?
Want to play movies in your SFML application? Check out sfeMovie!

zarka

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Benchmark : SDL vs SFML
« Reply #25 on: September 22, 2008, 11:22:43 pm »
Quote from: "Ceylo"
Quote from: "heishe"
plus if you use sdl + opengl you don't automatically get this nice oop layout that sfml has.

How do you handle events with SDL and without a loop ?


OOP (object oriented peogramming) not loop ;)
//Zzzarka

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Benchmark : SDL vs SFML
« Reply #26 on: September 22, 2008, 11:50:14 pm »
Quote from: "zarka"
OOP (object oriented peogramming) not loop ;)

Oh, k. Sorry :D .
Want to play movies in your SFML application? Check out sfeMovie!

ghiboz

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • http://www.ghiboz.com
Benchmark : SDL vs SFML
« Reply #27 on: November 13, 2008, 10:51:14 am »
Hi, I have a question about your benchmark...
does anybody thest the differences using directly opengl and sfml?
actually my project is working on simple opengl.. and the features of sfml are very cool... I wish understand if the performances slow down using sfml or are pretty equals!

regards

ghiboz :wink:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Benchmark : SDL vs SFML
« Reply #28 on: November 13, 2008, 11:26:46 am »
It wouldn't make sense. SFML is using OpenGL, so any direct OpenGL code will be slightly faster than SFML (unless it's really not optimized), because SFML will always be more generic than your specific code, and genericity has a cost (less optimizations are possible).

Basically, the main goal of using raw OpenGL over SFML is to get better performances.
Laurent Gomila - SFML developer

nitram_cero

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Benchmark : SDL vs SFML
« Reply #29 on: November 18, 2008, 03:39:48 am »
Quote
   SDL_Surface* App = SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE | SDL_DOUBLEBUF);


Maybe if you try with SDL_HWSURFACE (hardware) instead of SDL_SWSURFACE, it speeds things up.

Also, SDL_DisplayFormat is mandatory, or SDL will convert the bitmap on each blit, killing the framerate.

Regards
-Martín

 

anything