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

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

0 Members and 2 Guests are viewing this topic.

AdelR

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Benchmark : SDL vs SFML
« Reply #75 on: August 19, 2012, 03:09:55 am »
Thanks for building new benchmark.

First thing i noticed thou was that program won't start as it lacks libfreetype-6.dll and zlib1.dll. After finding latest versions of them the bench started.

My computer is i5-2500k, 8gb of RAM and GeForce GTX 570, no overcloking. Results were in range, except one unexpected:

1/ Test : sprites
SDL  displayed 384 frames
SFML displayed 301 frames
--> SFML is 0.8x as fast as SDL

2/ Test : alpha-blended sprites
SDL  displayed 102 frames
SFML displayed 301 frames
--> SFML is 3.0x as fast as SDL

3/ Test : rotating sprites
SDL  displayed 63 frames
SFML displayed 301 frames
--> SFML is 4.8x as fast as SDL

4/ Test : static text
SDL  displayed 3484 frames
SFML displayed 302 frames
--> SFML is 0.1x as fast as SDL

5/ Test : dynamic text
SDL  displayed 138 frames
SFML displayed 302 frames
--> SFML is 2.2x as fast as SDL


victorlevasseur

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: Benchmark : SDL vs SFML
« Reply #76 on: August 19, 2012, 09:49:24 am »
Do you limit framerate or activate V-sync, because the amount of frames is similar for each tests (301 or 302) ?

AdelR

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Benchmark : SDL vs SFML
« Reply #77 on: August 19, 2012, 11:54:19 am »
Yeah, totaly forgot. Set global V-sync not long ago.

1/ Test : sprites
SDL  displayed 428 frames
SFML displayed 1481 frames
--> SFML is 3.5x as fast as SDL

2/ Test : alpha-blended sprites
SDL  displayed 114 frames
SFML displayed 1504 frames
--> SFML is 13.2x as fast as SDL

3/ Test : rotating sprites
SDL  displayed 67 frames
SFML displayed 1502 frames
--> SFML is 22.4x as fast as SDL

4/ Test : static text
SDL  displayed 3648 frames
SFML displayed 27344 frames
--> SFML is 7.5x as fast as SDL

5/ Test : dynamic text
SDL  displayed 196 frames
SFML displayed 5559 frames
--> SFML is 28.4x as fast as SDL

Thou interesting, if v-sync was set, why was sdl ignoring it, while sfml wasn't?

victorlevasseur

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: Benchmark : SDL vs SFML
« Reply #78 on: August 19, 2012, 12:21:58 pm »
SDL don't use the graphic card (so, don't use its settings).
Without V-sync, we can see that SFML is still "better" than SDL in terms of performances.

AdelR

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Benchmark : SDL vs SFML
« Reply #79 on: August 19, 2012, 01:04:35 pm »
I was under the impression that new SDL was using hardware acceleration like SFML.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Benchmark : SDL vs SFML
« Reply #80 on: August 19, 2012, 01:09:13 pm »
To be honest, I consider this test a bit unfair, comparing GPU rendering to software rendering (IIRC SDL 1.2 is still on software, not sure about SDL 1.3/2.0).

Anyway, the difference is even more noticeable with a CPU that's a bit dated and a GPU that's state-of-the-art (Core 2 Quad 3 GHz, Geforce GTX 680; both on stock values/timing):

Quote
1/ Test : sprites
SDL  displayed 88 frames
SFML displayed 1129 frames
--> SFML is 12.8x as fast as SDL

2/ Test : alpha-blended sprites
SDL  displayed 38 frames
SFML displayed 1111 frames
--> SFML is 29.2x as fast as SDL

3/ Test : rotating sprites
SDL  displayed 26 frames
SFML displayed 1148 frames
--> SFML is 44.2x as fast as SDL

4/ Test : static text
SDL  displayed 1908 frames
SFML displayed 20391 frames
--> SFML is 10.7x as fast as SDL

5/ Test : dynamic text
SDL  displayed 142 frames
SFML displayed 3809 frames
--> SFML is 26.8x as fast as SDL

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Benchmark : SDL vs SFML
« Reply #81 on: August 19, 2012, 01:22:31 pm »
To be honest, I consider this test a bit unfair, comparing GPU rendering to software rendering (IIRC SDL 1.2 is still on software, not sure about SDL 1.3/2.0).
Well people often don't take that perspective into account, put SFML and SDL on the same level and argue about what's better etc. without really testing it. So this benchmark is not about fairness, it's about comparing the two libraries and providing facts that SFML should not only be the library of choice because of it's astetics (nice & clean C++ abstractions) but also because in most cases it performs better than SDL. ;)
Additionally the first benchmark was for SFML 1.x which also did quite a bit more stuff on the CPU rather than the GPU.

It's very interesting to see how vsync can limit SFML and that SFML performs also quite good on PCs with a better GPU than a CPU.

What the test actually fails to include is the judging of the output. I mean on my PC the sprite rotations with SDL just stutter and are useless where as the ones with SFML run smoothly.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Re: Benchmark : SDL vs SFML
« Reply #82 on: August 19, 2012, 02:30:52 pm »
You might want to do a test using SDL_gfx as well.
It's a very common SDL extension that does smooth rotations, scaling and features drawing of primitives.

Back in the day, I used it and rotations were pretty smooth.
http://www.ferzkopp.net/joomla/content/view/19/14/

I think add-ons like these are making SDL hard to compare to SFML. Not idea if they should be considered for benchmark tests like these...

I can't really tell what's more common, SGE or SDL_gfx. But personally I didn't know SGE yet.
« Last Edit: August 19, 2012, 02:33:33 pm by pdinklag »
JSFML - The Java binding to SFML.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Benchmark : SDL vs SFML
« Reply #83 on: August 19, 2012, 02:59:42 pm »
If you know your way around SDL_gfx you could rewrite the test for it. I'm not familiar with SDL at all, so I'd have to dig deeper into it.

Of course diffrent modules makes it hard to compair but as I already stated earlier most people just argue about if SDL is better than SFML and those are mostly the same people that will use extentions like SGE or SDL_gfx. Also if you'd just want to do a pure SDL comparison then you'll probably just have to look at the first two tests and maybe add a pixel manipulation test. That's another factor where SFML shines, it isn't limited to just drawing images but provides much more and doesn't require you to make decisions between diffrent extentions. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Benchmark : SDL vs SFML
« Reply #84 on: August 19, 2012, 08:12:10 pm »
Oh please, don't start the "GPU vs CPU" discussion again.

And as far as I remember, SDL 2.0 has a totally different API with windows and renderers -- and it is hardware accelerated. So this "new" benchmark is obviously not using it, and is just equivalent to the old one.
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Benchmark : SDL vs SFML
« Reply #85 on: August 19, 2012, 09:43:40 pm »
Oh please, don't start the "GPU vs CPU" discussion again.
Again? Must have been before my time. ;)

And as far as I remember, SDL 2.0 has a totally different API with windows and renderers -- and it is hardware accelerated. So this "new" benchmark is obviously not using it, and is just equivalent to the old one.
Yeah it was never my idea to make a new comparision, I just revived the old one but now for SFML 2. Maybe if some SDL user want he could implement it for SDL 2. :)
« Last Edit: August 19, 2012, 10:40:31 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Benchmark : SDL vs SFML
« Reply #86 on: August 19, 2012, 09:57:42 pm »
Since SDL 1.2 is many years old, and SDL 2.0 is coming in a few weeks, it would be more than fair to make the comparison with the new version. Using the old SDL 1.2 adds nothing to this topic.
Laurent Gomila - SFML developer

Qix

  • Full Member
  • ***
  • Posts: 139
  • I am Qix!
    • View Profile
    • Natoga Technologies
Re: Benchmark : SDL vs SFML
« Reply #87 on: September 20, 2012, 01:16:01 pm »
Oh please, don't start the "GPU vs CPU" discussion again.

And as far as I remember, SDL 2.0 has a totally different API with windows and renderers -- and it is hardware accelerated. So this "new" benchmark is obviously not using it, and is just equivalent to the old one.

Indeed it does. SDL 2.0 is hardware accelerated, and its structure is kind of similar to SFML's WindowRenderer and TextureRenderer classes (IIRC).

However, as far as complexity goes, SFML is the better choice for OOP base infrastructure, simply because it was built for it.

However, it'd be interesting to benchmark with SDL 2.0. Good luck getting the layout of the code to work; the workflow and API diagrams are incredibly different between SDL2 and SFML.
~ Qix
Creator of Rippl Studio
Code: [Select]
<danharibo> iostream: I don't do enough drugs to think that's a good idea.

swarminglogic

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Benchmark : SDL vs SFML
« Reply #88 on: May 29, 2013, 02:30:12 am »
In case anyone wanted an updated benchmark, using hardware accelerated SDL 2.0.0, instead of software rendering in SDL 1.2, it's available here: https://github.com/swarminglogic/SFML-vs-SDL-Benchmark

The results between SDL and SFML are much closer now.

PS: Hi everyone, I'm new here.
PPS: Sorry if it's bad to reply to an old post.
« Last Edit: May 29, 2013, 02:32:02 am by swarminglogic »

Cornstalks

  • Full Member
  • ***
  • Posts: 180
    • View Profile
    • My Website
Re: Benchmark : SDL vs SFML
« Reply #89 on: May 29, 2013, 02:57:44 am »
The results between SDL and SFML are much closer now.
Would be interesting to hear what your hardware (and results) are.

 

anything