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
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
SFML displayed 14 frames
--> SFML is 466% faster than SDL
2/ Test : alpha-blended sprites
SDL displayed 3 frames
SFML displayed 14 frames
--> SFML is 466% faster than SDL
3/ Test : rotating sprites
SDL displayed 2 frames
SFML displayed 14 frames
--> SFML is 700% faster than SDL
4/ Test : static text
SDL displayed 408 frames
SFML displayed 641 frames
--> SFML is 157% faster than SDL
5/ Test : dynamic text
SDL displayed 310 frames
SFML displayed 453 frames
--> SFML is 146% faster than SDL
Config
Mainboard socket AM2 : ASRock ALiveSata2-GLAN
CPU socket AM2 : Athlon 64 X2 4200+
Memory : 2X 512 MB DDR2
Harddisk 3.5" S-ATAII 7200rpm
Graphic Card : ATI His Exaclibur Radeon X1650 256 MB
OS : XP Home
1/ Test : sprites
SDL displayed 10 frames
SFML displayed 111 frames
--> SFML is 1110% faster than SD
2/ Test : alpha-blended sprites
SDL displayed 6 frames
SFML displayed 111 frames
--> SFML is 1850% faster than SD
3/ Test : rotating sprites
SDL displayed 3 frames
SFML displayed 111 frames
--> SFML is 3700% faster than SD
4/ Test : static text
SDL displayed 915 frames
SFML displayed 3953 frames
--> SFML is 432% faster than SDL
5/ Test : dynamic text
SDL displayed 718 frames
SFML displayed 1026 frames
--> SFML is 142% faster than SDL
AMD Athlon X2 3800+ EE
2 GB DDR2-800 Ram in dual channel
GeForce 7600 GT
Asus Motherboard with nForce 570 ultra chipset
Windows XP 64bit edition
1/ Test : sprites
SDL displayed 9 frames
SFML displayed 313 frames
--> SFML is 3477% faster than SDL
2/ Test : alpha-blended sprites
SDL displayed 6 frames
SFML displayed 238 frames
--> SFML is 3966% faster than SDL
3/ Test : rotating sprites
SDL displayed 3 frames
SFML displayed 278 frames
--> SFML is 9266% faster than SDL
4/ Test : static text
SDL displayed 942 frames
SFML displayed 9795 frames
--> SFML is 1039% faster than SDL
5/ Test : dynamic text
SDL displayed 729 frames
SFML displayed 999 frames
--> SFML is 137% faster than SDL
AMD Athlon 64 X2 Dual Core 6000+ 3.00GHz
2 GB DDR2-800 Ram
GeForce 8800GTS
MSI Motherboard with nForce 560
Windows Vista
1/ Test : sprites
SDL displayed 13 frames
SFML displayed 516 frames
--> SFML is 3969% faster than SDL
2/ Test : alpha-blended sprites
SDL displayed 8 frames
SFML displayed 543 frames
--> SFML is 6787% faster than SDL
3/ Test : rotating sprites
SDL displayed 4 frames
SFML displayed 562 frames
--> SFML is 14050% faster than SDL
4/ Test : static text
SDL displayed 1106 frames
SFML displayed 8417 frames
--> SFML is 761% faster than SDL
5/ Test : dynamic text
SDL displayed 894 frames
SFML displayed 1318 frames
--> SFML is 147% faster than SDL
AMD Athlon 64 X2 Dual Core 6000+ 3.00GHz
2 GB DDR2-800 Ram
GeForce 8500GT
Ubuntu Linux ( 2.6.22-14-generic )
1/ Test : sprites
SDL displayed 20 frames
SFML displayed 137 frames
--> SFML is 685% faster than SDL
2/ Test : alpha-blended sprites
SDL displayed 7 frames
SFML displayed 98 frames
--> SFML is 1400% faster than SDL
3/ Test : rotating sprites
SDL displayed 4 frames
SFML displayed 134 frames
--> SFML is 3350% faster than SDL
4/ Test : static text
SDL displayed 1267 frames
SFML displayed 4600 frames
--> SFML is 363% faster than SDL
5/ Test : dynamic text
SDL displayed 1020 frames
SFML displayed 1625 frames
--> SFML is 159% faster than SDL
Your benchmarks are severly flawed. You are comparing the software, 2D library that ships with SDL to OpenGL. Of course you are going to get a huge difference in performance - you don't even need to perform a benchmark to understand that.
What would be really interesting is to see how an SDL-driven OpenGL application performs compared to SFML. That would be a meaningful test, for two reasons: it compares similar technologies and it benchmarks against SDL the way SDL is almost always used.
for( int i = 0; i < 5; ++i ) Images = SDL_DisplayFormat(Images);
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.
This highly depends on the system you test with.
AMD Athlon X2 3800+
GeForce 6100
Windows XP
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.
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.
As you can see sprites drawing without alpha using SDL is faster then using SFML.
plus if you use sdl + opengl you don't automatically get this nice oop layout that sfml has.
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 ;)
SDL_Surface* App = SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE | SDL_DOUBLEBUF);
Your benchmarks are severly flawed. You are comparing the software, 2D library that ships with SDL to OpenGL. Of course you are going to get a huge difference in performance - you don't even need to perform a benchmark to understand that.
What would be really interesting is to see how an SDL-driven OpenGL application performs compared to SFML. That would be a meaningful test, for two reasons: it compares similar technologies and it benchmarks against SDL the way SDL is almost always used.
Initially standing for "Atari Low-Level Game Routines"...for the Atari ST in the early 1990s.
you don't mention exactly what you're testing (software SDL vs hardware SFML)
Indeed, SDL 1.3 (as opposed to SDL 1.2 used in this benchmark) uses hardware acceleration on its 2d graphics, just like SFML.
First, this topic is not about the speed difference between SDL and SFML. It's about speed & easiness. The only thing that I want to show is that you can get both of them with SFML, not with SDL.
You can get a code as simple as SFML (this is my first version of the benchmark) but with poor performances, or you can get a code almost as fast as SFML but with tons of addons and tweaks (this is your version).
I'm testing SDL and SFML. Hardware / software is just an implementation detail.
Moreover, does hardware SDL exist? SDL 1.3 is still in progress, and SDL + OpenGL... well it's OpenGL, not SDL.
I already had a look at SDL 1.3, but was too lazy to try figuring out how it works (I mean, the public API). I'm really curious to see it in action :)
There is a big difference between SDL and SFML in that SDL covers the crossplatform basics and you choose libraries for your task (the "pick-and-choose" approach), whereas SFML wraps and makes available everything you might need (the "one-stop-shop" approach)
You are an expert with SFML, so I thought SDL needed someone with experience to make the benchmark more viable
It's not just an implementation detail. It means real things on various platforms. If you're on an embedded system with no GPU, then SDL and other software-optimized libraries are much, much faster than a software OpenGL implementation.
Yes, hardware SDL exists. In its original form, you've been using it by using SDL_HWSURFACE (i.e. requesting a surface in video memory)
glSDL is a replacement of the SDL backend with an OpenGL one
A similar, but not identical, idea is what has become SDL 1.3.
1/ Test : sprites
SDL displayed 168 frames
SFML displayed 736 frames
--> SFML is 4.38x as fast as SDL
2/ Test : alpha-blended sprites
SDL displayed 12 frames
SFML displayed 505 frames
--> SFML is 42.08x as fast as SDL
3/ Test : per-pixel alpha-blended sprites
SDL displayed 16 frames
SFML displayed 709 frames
--> SFML is 44.31x as fast as SDL
4/ Test : rotating sprites
SDL displayed 30 frames
SFML displayed 691 frames
--> SFML is 23.03x as fast as SDL
5/ Test : static text
SDL displayed 756 frames
SFML displayed 7273 frames
--> SFML is 9.62x as fast as SDL
6/ Test : dynamic text
SDL displayed 116 frames
SFML displayed 3697 frames
--> SFML is 31.87x as fast as SDL
7/ Test : dynamic text w/NFont
SDL displayed 606 frames
SFML displayed 4575 frames
--> SFML is 7.55x as fast as SDL
1/ Test : sprites
SDL displayed 51 frames
SFML displayed 69 frames
--> SFML is 1.4x as fast as SDL
2/ Test : alpha-blended sprites
SDL displayed 24 frames
SFML displayed 69 frames
--> SFML is 2.9x as fast as SDL
3/ Test : rotating sprites
SDL displayed 14 frames
SFML displayed 71 frames
--> SFML is 5.1x as fast as SDL
4/ Test : static text
SDL displayed 804 frames
SFML displayed 2566 frames
--> SFML is 3.2x as fast as SDL
5/ Test : dynamic text
SDL displayed 119 frames
SFML displayed 2300 frames
--> SFML is 19.3x as fast as SDL
1/ Test : sprites
SDL displayed 27 frames
SFML displayed 48 frames
--> SFML is 1.8x as fast as SDL
2/ Test : alpha-blended sprites
SDL displayed 12 frames
SFML displayed 53 frames
--> SFML is 4.4x as fast as SDL
3/ Test : rotating sprites
SDL displayed 6 frames
SFML displayed 51 frames
--> SFML is 8.5x as fast as SDL
4/ Test : static text
SDL displayed 479 frames
SFML displayed 1110 frames
--> SFML is 2.3x as fast as SDL
5/ Test : dynamic text
SDL displayed 33 frames
SFML displayed 464 frames
--> SFML is 14.1x as fast as SDL
I don't understand the point of this test.
It's like testing a software renderer vs. Direct3D and concluding that Direct3D is faster.
An obvious conclusion, but some people don't know about this. So what's wrong with it?
I don't understand the point of this test.Except it uses hardware accelerated SDL(through Direct3D) and hardware accelerated SFML(through OpenGL).
It's like testing a software renderer vs. Direct3D and concluding that Direct3D is faster.
SDL isn't meant for computers with hardcore graphics accelerators (AKA modern GPUs).
SFML is meant for computers with decent if not hardcore GPUs.
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.
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.
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.
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.
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).
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?
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.
I thought an XNA port of SFML would be cool.
Quote from: "Ashenwraith"I thought an XNA port of SFML would be cool.
I don't think "cool" is good reason for Laurent to implement a XNA backend :lol: . Moreover it'd be a huge work, it's not portable, and benefits still need to be demonstrated. Thus Laurent might keep using OpenGL :P .
I wasn't proposing Laurent make an XNA backend, [...]
As for the benefits, I was rather thinking of the benefits of using XNA, not of making a port for Xbox 360, even if both are linked. So.. ok as far as the benefits of a Xbox 360 port, even if I don't know whether it's achievable.
A similar benchmark between sfml2 and sfml1.6 would be very interesting :)
Now that SFML 2.0 and SDL 1.3 APIs have stabilized it would be interesting to see new benchmark.You like to play with fire bumping a nearly one year old thread as your second post, but fear not, as the SFML community doesn't forbid this. ;D
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
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. ;)
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. :)
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.
The results between SDL and SFML are much closer now.Would be interesting to hear what your hardware (and results) are.
The results between SDL and SFML are much closer now.Would be interesting to hear what your hardware (and results) are.
Sorry if it's bad to reply to an old post.It's ok, except for this particular thread ;D