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

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

0 Members and 2 Guests are viewing this topic.

nullsquared

  • Newbie
  • *
  • Posts: 27
    • View Profile
Benchmark : SDL vs SFML
« Reply #45 on: January 11, 2010, 11:09:51 pm »
Quote from: "K-Bal"


An obvious conclusion, but some people don't know about this. So what's wrong with it?

What's wrong with it?  Exactly what I pointed out.

Same thing as comparing a Nissan Quest to a Lamborghini Gallardo and concluding that the Gallardo is faster.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Benchmark : SDL vs SFML
« Reply #46 on: January 12, 2010, 12:08:34 am »
Oh please, don't do it again...

Ok, I'll try to make it simple. SDL and SFML have similar 2D APIs, right? So why the hell shouldn't they be compared? It's up to SDL if it's not implemented with the fastest low-level API available. Do beginners care about whether their 2D library uses OpenGL or not? They just want it to be fast, they don't know what OpenGL is.

And when SDL 1.3 is released with its OpenGL backend, this benchmark will suddenly make sense? Oh no wait, it will have a Direct3D backend as well, so it cannot be compared against SFML, this is not fair.

And what about a library that would not be open-source? It couldn't be compared to anything because we don't know what backend it uses? ...

Sorry for being sarcastic, but everyone says that SDL cannot be as fast as SFML; I'm just demonstrating it with numbers, because this is not obvious for everyone on earth.
In my opinion they are two similar APIs and it would not be fair not to compare them.
Laurent Gomila - SFML developer

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Benchmark : SDL vs SFML
« Reply #47 on: January 12, 2010, 01:58:32 am »
Quote from: "nullsquared"
I don't understand the point of this test.

It's like testing a software renderer vs. Direct3D and concluding that Direct3D is faster.
Except it uses hardware accelerated SDL(through Direct3D)  and hardware accelerated SFML(through OpenGL).
I use the latest build of SFML2

nullsquared

  • Newbie
  • *
  • Posts: 27
    • View Profile
Benchmark : SDL vs SFML
« Reply #48 on: January 12, 2010, 03:24:03 am »
SDL isn't meant for computers with hardcore graphics accelerators (AKA modern GPUs).

Just like a Nissan Quest is a family car, not a sports car for some rich guy.

SFML is meant for computers with decent if not hardcore GPUs.

Just like a Lamborghini Gallardo.

Yes, the noob will take a look at both cars and say, "of course I want the Gallardo, it's so much faster and cooler looking!"

That doesn't mean the Nissan Quest is now useless, which is essentially what you're trying to show in this benchmark.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Benchmark : SDL vs SFML
« Reply #49 on: January 12, 2010, 08:30:47 am »
Quote
SDL isn't meant for computers with hardcore graphics accelerators (AKA modern GPUs).

That's a tough statement. Basically, you're saying that SDL is deprecated for desktop computers, which represents a vast majority of users now. I wouldn't say that...

Quote
SFML is meant for computers with decent if not hardcore GPUs.

Well, it can also run fine with OpenGL 1.1 crappy drivers, like the Intel GPUs we can find on old laptops. I don't call that "hardcore". And I'm sure that I can find a software OpenGL implementation that can run without a GPU. That's the beauty of using a standard and widely implemented graphics API.

Quote
Yes, the noob will take a look at both cars and say, "of course I want the Gallardo, it's so much faster and cooler looking!"

How can he tell if there's no benchmark at all? People shouldn't have to look into internal details and document themselves about low-level technologies in order to know which one is faster.

Quote
That doesn't mean the Nissan Quest is now useless, which is essentially what you're trying to show in this benchmark.

Absolutely not. I'm just showing that SFML is better when we compare both easiness and performances of the 2D API together. SDL can have the same API but with bad performances, or it can get the same performances but with additional tweaking or even other thrid-party libraries.
And believe me or not, but I don't like this benchmark. I did it to make people happy, I had tons of users who wanted such a benchmark.
Laurent Gomila - SFML developer

T.T.H.

  • Full Member
  • ***
  • Posts: 112
    • View Profile
Benchmark : SDL vs SFML
« Reply #50 on: January 13, 2010, 11:17:43 am »
When you ask the internet for a 2D graphic library ("car") the internet usually points you on SDL ("Nissan"). Next to some other interesting 2D libraries some clever people will even point you on SFML ("Lamborghini").

Yes, SDL in it's most basic form is a software-renderer and SFML is a hardware-accelerated-renderer and, yes, the hardware requirements of SDL are insanely low (code for your fridge) while those of SFML seem to be pretty low (code for your laptop).

But, and that is my personal uber-mega-super-power-argument-but, when you enter the SDL Nissan, you'll find out that the wheels are not completely round, that the steering wheel goes strong, that the security belts are week, that the gas it needs is antique, that features like lights, windscreen wiper, heating and radio are extras you have to buy and install yourself and that the final driving experience absolutely and totally feels like a fight against the car itself.

On the other hand, when you enter the SFML Lamborghini and do have some rogue experience with cars already you'll find out that all the controls and the steering feel familiar, that all basics and most uncommon extras and even some fancy gadgets are already included, that the gas tank is full and when you start the engine and push the pedal you'll race off like a sports car and will immediately have fun while driving.

nullsquared

  • Newbie
  • *
  • Posts: 27
    • View Profile
Benchmark : SDL vs SFML
« Reply #51 on: January 13, 2010, 12:59:47 pm »
Quote from: "T.T.H."

But, and that is my personal uber-mega-super-power-argument-but, when you enter the SDL Nissan, you'll find out that the wheels are not completely round, that the steering wheel goes strong, that the security belts are week, that the gas it needs is antique, that features like lights, windscreen wiper, heating and radio are extras you have to buy and install yourself and that the final driving experience absolutely and totally feels like a fight against the car itself.


Your SFML metaphor sounds correct but your SDL one does not.  It seems that the driver is someone who has never stepped in the driver's seat of a car ever before and simply does not know what to expect.

SDL may be slower than SFML (moot argument for reasons I've previously pointed out), but it is definitely not a fight against itself - it has its uses.

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
Benchmark : SDL vs SFML
« Reply #52 on: January 13, 2010, 09:20:00 pm »
God, you are driving me crazy with cars, lamborginis, nissans and shit lol.

SFML is faster than SDL, so this benchmark proves that. I don't care about software or hardware. It's just SFML > SDL. No more.

hacky

  • Newbie
  • *
  • Posts: 26
    • View Profile
Benchmark : SDL vs SFML
« Reply #53 on: January 16, 2010, 08:37:36 pm »
Quote
SFML is faster than SDL, so this benchmark proves that. I don't care about software or hardware. It's just SFML > SDL. No more.

this.

T.T.H.

  • Full Member
  • ***
  • Posts: 112
    • View Profile
Benchmark : SDL vs SFML
« Reply #54 on: January 18, 2010, 10:57:36 am »
Quote from: "nullsquared"
Your SFML metaphor sounds correct but your SDL one does not.  It seems that the driver is someone who has never stepped in the driver's seat of a car ever before and simply does not know what to expect.

SDL was the second 2D engine I ever used (after some simple sprite blitting based on DirectX5/DirectX7) and for me it felt "awkward" to work with. When I found SFML and tried the very same things with it everything felt "intuitive" for me.

In SDL I spent time with getting the surfaces allocated in the correct color format and getting some sprites rotated. In SFML those things did cost me minutes and I spend less time with the graphic basics and more time with my game logic.

Indeed this all is a very personal and subjective experience but as the leap had been so huge for me I keep telling my story. I strongly believe that for a beginner who wants to make something 2D based in C++ for a modern platform like a desktop or laptop PC SFML is a far, far better choice than SDL .

Regarding speed (FPS) the hardware-accelerated SFML is obviously faster than the software-rendered SDL. I think it is superfluous to argue that one is better than the other due to the speed argument.

In addition SDL does loose even more appeal in my eyes after reading that there will be a commerial license for it (with all the cool features of course like e.x. statically linking). Nothing against paying good money for good software but in my case I can get all I want (usability, speed, coding for the laptop, not coding for the fridge = SFML) for free (SFML's zlib/png license).

nachy

  • Newbie
  • *
  • Posts: 8
    • View Profile
Benchmark : SDL vs SFML
« Reply #55 on: March 28, 2010, 05:26:51 am »
Quote from: "T.T.H."
In addition SDL does loose even more appeal in my eyes after reading that there will be a commerial license for it (with all the cool features of course like e.x. statically linking). Nothing against paying good money for good software but in my case I can get all I want (usability, speed, coding for the laptop, not coding for the fridge = SFML) for free (SFML's zlib/png license).

This is exactly the reason why I chose SFML now. Not any performance difference, nor OOP aspect. Only the license.
For me SDL used to be THE free lib for platform independent graphic stuff even if it never was with it's gpl license but this step towards adding a commercial license killed it for me. Their comparison chart alone is so yuck.
I guess it's ok if you actually want to use it commercially or want to bother with the GPL but I've come to the conclusion that I want to bother with licenses the least possible with my small projects and the zlib/png one is perfect for that.

I'm sure you can also code fast software with SDL if you tweak things, use HW rendering, OpenGL and so on. The tests were supposed to show a difference with "default settings" though I think. Like if you're new to both libs and write your first application. Some people are taking it too serious.

On a side note this little application I have seems to be running faster with still-WIP-SFML2 than it did with SFML1.5. So either it's just something related to my application or SFML will have some performance gain once version 2 is a stable release  :)

Ashenwraith

  • Sr. Member
  • ****
  • Posts: 270
    • View Profile
Benchmark : SDL vs SFML
« Reply #56 on: April 13, 2010, 05:05:49 pm »
This thread is smart and a good idea.

Benchmarking SFML against SDL should be standardized with each major release of SFML--or at least the benchmark executable updated.

BTW, I found SFML by searching "better than SDL" and "SDL sucks"  8)

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Benchmark : SDL vs SFML
« Reply #57 on: April 13, 2010, 07:03:23 pm »
As long as SFML is "around SDL" in terms of performance, anything more is just a bonus to me. I use SFML for its design, very active development, and great 2d support. Any speed improvements are just a bonus. How many of you are actually 1) hitting a frame rate limit, 2) have a reasonable amount of rendering being done, and 3) have already optimized your rendering? There is a huge amount of stuff you can do to optimize rendering on the user side. From what I can see, SFML is pretty much bottlenecked by the drawing calls, which is usually what happens with most 2d engines. So there likely isn't a whole lot SFML can do besides batching, but even then I have had mixed results when it comes to that since batching in 2d isn't always so beneficial.

Focus on designing your game. If by the time you finish, and your game isn't running fast enough, optimize the way you are rendering and add some support for toggling effects/quality. If that still isn't enough, then you can consider SFML's performance. Until then, its just "an interesting statistic".

Ashenwraith

  • Sr. Member
  • ****
  • Posts: 270
    • View Profile
Benchmark : SDL vs SFML
« Reply #58 on: April 13, 2010, 07:25:13 pm »
Quote from: "Spodi"
As long as SFML is "around SDL" in terms of performance, anything more is just a bonus to me. I use SFML for its design, very active development, and great 2d support. Any speed improvements are just a bonus. How many of you are actually 1) hitting a frame rate limit, 2) have a reasonable amount of rendering being done, and 3) have already optimized your rendering? There is a huge amount of stuff you can do to optimize rendering on the user side. From what I can see, SFML is pretty much bottlenecked by the drawing calls, which is usually what happens with most 2d engines. So there likely isn't a whole lot SFML can do besides batching, but even then I have had mixed results when it comes to that since batching in 2d isn't always so beneficial.

Focus on designing your game. If by the time you finish, and your game isn't running fast enough, optimize the way you are rendering and add some support for toggling effects/quality. If that still isn't enough, then you can consider SFML's performance. Until then, its just "an interesting statistic".


Speaking of performance, how is xna/directx working for 2d?

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Benchmark : SDL vs SFML
« Reply #59 on: April 14, 2010, 02:57:39 am »
Quote from: "Ashenwraith"

Speaking of performance, how is xna/directx working for 2d?


Xna actually has surprisingly great support for 2D. Its not as simple as SFML, but one big thing they have going for them is their SpriteBatch class. There are 5 sorting methods:
1. Immediate: Draw whenever the state (texture) changes.
2. Texture: Draw everything at once, ordered by texture (for when stuff doesn't overlap).
3. Deferred: Draw all at once in the same order called (same as Immediate, but delayed, I believe - its so you can build up multiple batches at once without messing up the drawing).
4. Front-to-back: Deferred, but sorted by depth.
5. Back-to-front: Deferred, but sorted by depth (other direction).

I personally only really used Immediate, since I find it easy enough to handle the ordering myself. I assume this is pretty much like the batching Laurent added to SFML 2.0. If a call to draw uses the same state as the last call, you queue it into the batch. If the state changes, you flush the queue, clear it, then place the newest call in the front of the batch. Combined with texture atlases, I was able to render my whole scenes in under 30-or-so batches.

However, with XNA, you are in a load of hurt if you try to do things your own way. One reason I switch from XNA to SFML for my project was since I didn't like how XNA's ContentManager worked. Switching to SFML, I had a robust content manager that supports lazy-loading, only loading one instance of each asset, and automatic asset reloading (if you call an asset that has been disposed, it reloads from file transparently) done very quickly. Trying to do this with XNA, I gave up after about a full day of working on it, and tons of hacking with reflection.

In my project, since I just replaced XNA with SFML, things are being used pretty much the same way. From what I can see, the only real performance hits are coming from the fact that I no longer have any batching. But even still, I am hitting 60 FPS no sweat. I think the SFML version is running about 50%* slower while doing the exact same stuff (even using texture atlases still), but again, we're comparing no batching to batching, and I am still using SFML 1.5. And my rendering is still written with XNA in mind, not SFML.

*This is a complete guess from memory based purely on approximate numbers I remember when looking at the Task Manager. In no way have I EVER actually measured it.

As far as simplicity goes, SFML beats XNA hands-down for 2D. Its quite scary how simple SFML is. And at least when you don't like how something works in SFML, you can roll your own without a fight.

 

anything