I'm not trying to be a fanboy of SDL, but when people on this and other sites categorically insist that SFML is faster than SDL, I just have to respectfully disagree. Before I explain why, I will add that SFML is undoubtedly good and in many ways is better than SDL, so don't take this as a bash, because it isn't.
Basically, on my single-core eMachines computer running 32-bit WinXP, SDL has a faster framerate for straight blitting than SFML. My thinking is that since as a developer you generally aim for the best performance on a lowest-common-denominator machine for when it comes to simple 2D games, I have stuck with SDL. I will add that the interesting thing about OpenGL (and therefore, SFML) is the fact that it can rotate an object faster than it can move it across the screen on my machine. When people talk about hardware acceleration, all I can think is that on common hardware that basically doesn't have 3D acceleration, using "hardware acceleration" actually slows down graphically-intense programs.
I don't know whether people who insist that SFML is faster than SDL are just parroting popular beliefs or if they have actually run their own benchmarks to prove it to themselves; and again, in the latter case the data would only be a valid reflection of machines similar to their own, which may be a quad-core 64-bit with good 3D hardware acceleration. Peace! -B
Neither one is going to be the clear winner 100% of the time. SFML is faster most of the time, which is probably why it is often said to be faster.
You need to consider whether or not you have the hardware to do the work. SFML/OpenGL relies on the hardware being there. SDL does not. Therefore if you have the hardware, SFML is probably going to be faster. If you don't, SDL will probably be faster.
Most people interested in games have the hardware. eMachines are not designed for games. Honestly I don't know what they're designed for... they seem to be heaping piles of crap from what I can tell. So it's no surprise to me that SFML doesn't perform well on them.
If you are getting questionalbe performance, I would recommend checking your drivers and make sure you have something that plays nice with OpenGL. When supported, OpenGL is blazing fast. The problem is it isn't always supported.
"they seem to be heaping piles of crap from what I can tell" indeed. From what I can tell, they are low-cost general purpose computers that people like me buy from one of the two most popular "wholesale" outfits (one starts with the letter 'S', the other with the letter 'C') that are designed as stand-alone and relatively non-upgradeable units that can be replaced every 5-8 years by another cheap model at said "wholesale" outfits. I perceive my "market" as being just the general computer user who perhaps plays casual games and I'd rather not criticize their hardware so much. With a framerate sustained (on my computer) of over 400 fps, I'm not worried about my game being slow on any computer, so the lowest common denominator principle works pretty well from where I'm sitting.
As for SFML being faster most of the time, I wonder if there are some stats somewhere about what the "average" computer is nowadays, as well as the "lowest common denominator"--not the lowest rare denominator like DOS, CGA, etc. I think everyone, myself included, tends to see themselves as typical insofar as the hardware they're using being common. That said, hopefully I'll be heading to the "wholesale outlet" sometime soon to get a 64-bit duo-core eMachine for $400; that's the deal I saw last time I was there, surprising as that was to myself and some others.
Good news! The rapidly stabilizing SDL 1.3 has OpenGL/Direct3D hardware acceleration. so users of good hardware won't feel like they're the victims of reverse-class snobbery! The innovator (SDL) is catching up to the refiner (SFML)!
I just want to pay respects to E-machines former glory. Many people do not remember that before Gateway bought them out they were a respectable company, they provided low profile and low power machines with moderate performance. Sure they never made a case where you didn't need a bandage after working on them, and their infantile insistence on being the only OEM to exclusivley use Mini-ITX made finding compatible parts a part time job all on its own, their cases had no space for upgrades what so ever, sure their internal layout cut the air-flow so close to the bone that one could forget about overclocking because even interupting the fan with a sneeze would cause the thing to catch fire.... You know what? I forgot where I was going with this. F*** YOU E-MACHINES! <- Think Denise Leary style comedy, not real anger.
EDIT @ formerBGIuser: I don't need statistics to see that SFML is built on top of OpenGL which communicates directly with video hardware and which every video hardware vendor supports. Modern video rendering hardware is so far ahead of what software would actually require, that vendors are seperating entire lines of their goods based on inconsequential differences and loading Video Cards with more VRAM then any modern game is ever going to use. Do you remeber the Final Fantasy movie? Remember how long ago that came out? All of the hardware that went into making that is now obsoulete twice over again. How much power do you think a game needs?
@Computergeek01 Well I just like to have peak performance when I can for my 2D games. Btw, recently I started using Jonathan Dearborn's SPriG library, an SDL-based graphics library which has a dirty-rect system in it. When I got my dirty-rect demo working, it had a frame-rate of almost 3000 FPS on my single-core emachines computer, so I was pretty pleased with that! The more contempt you have for 5 year old hardware and the people who use it, the smaller your market is, that's my attitude! You have to remember (though you never knew) that with my background and age, I'm comparing blitting to the kind of animation I used to do with the BGI back in the late 80s!
EDIT P.S. I'm sorry about the hand, and you sure know your hardware what with the talk about overclocking.
formerBGIuser, software implementations are considered the true global solution, where as hardware implementations require... well... hardware. However, almost any modern computer (within what... the past 10 years?) has the capability of using a hardware accelerated implementation of rendering context.
Also, please note that SDL was made quite a long time ago. In SDL 1.3, they remove the need to explicity define what type of surface (now called window wrong... they have you create a window and then grab a surface from the window) you want. They probably auto detect if hardware acceleration is allowed then default to it.
However, on micro devices that don't even have hardware acceleration (which is very uncommon as of recently), software rendering is fine, especially for small games like breakout or tetris (or most 2D based games).
SDL blitting is software based, using the core CPU (no hardware acceleration). Does not need a video card or chip to even use SDL blitting which is why it was so popular.
Even then, SDL is well more straight forward than SFML as well as mature. I mix it with some OpenGL and it's the most perfect utility kit I've seen.
Interesting thread. I've got a little bit of input.
I've been using SDL for around a year and a half, and just recently gotten into SFML. As far as speed goes, I've never gotten below my preferred frame rate in either lib, not with 1000 objects on screen all preforming collision detection in the most inefficient way possible, not with some horribly written classes to move the camera about, and not with my horribly defined sprites. I can honestly say I like working in SDL more, because I have to do more. However SFML is so much easier to work with, it already has a ton of great features (like blending), and it's quicker to develop in(imho).
Take it for what it's worth.
Now I've been working a little bit with (mathematical)vectors and such things(polar coord, etc) and I do have a question for you openGL buffs. I would like to preform simple rotation of my sprites in SDL with OpenGL, is there a quick and dirty method? SFML has spoiled me with it's stinking SetRotation() method...