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

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

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Benchmark : SDL vs SFML
« on: August 28, 2007, 02:41:56 pm »
Hi everybody

A lot of people wonder how SFML compares to SDL, that's why I wrote a small benchmark to compare a few key features, mainly displaying sprites and text.

The tests consists of counting the number of frames rendered during 5 seconds :

1/ Displaying 2000 static sprites
2/ Displaying 2000 alpha-blended static sprites
3/ Displaying 2000 rotating sprites
4/ Displaying 20 lines of static text
5/ Displaying 20 lines of dynamic text

I used SDL_gfx for sprites rotations and SDL_ttf for displaying text. The latest versions of these libraries, as well as SDL, were used.

Source code + binaries + images + VS2005 files can be downloaded here :
http://sfml.sourceforge.net/temp/bench-sdl-sfml.zip (1.15 Mo)

Here are the results on a high configuration (AMD Athlon 64 DualCore 3800+, GeForce 7800 GT, 1 Go de RAM, Windows XP) :
Code: [Select]
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

Results on Linux with the same config are similar (a bit better for SFML).

Here are the results on a low configuration (Intel Pentium M 1.73 Ghz, integrated GPU Intel 915GM, 256 Mo de RAM, Windows XP) :
Code: [Select]
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


As you can see SFML is faster than SDL, and it has to do with the use of OpenGL for getting hardware acceleration. Moreover, the 2D part of SFML has not been heavily optimized, and could be faster if needed.

If you have any question or suggestion about this benchmark, or any idea for something else to compare, feel free to discuss it here.
Laurent Gomila - SFML developer

lubos

  • Newbie
  • *
  • Posts: 17
    • ICQ Messenger - 385328377
    • MSN Messenger - qwarmail@yahoo.co.uk
    • View Profile
Benchmark : SDL vs SFML
« Reply #1 on: August 28, 2007, 03:05:52 pm »
Very nice  :D

WinXP SP2, intel p4 1.8ghz, 512bm ram, ati radeon 7500:

Code: [Select]

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

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Benchmark : SDL vs SFML
« Reply #2 on: August 28, 2007, 05:15:49 pm »
With my PC :
Quote
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


Code: [Select]
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


Hiura
SFML / OS X developer

CareBear

  • Newbie
  • *
  • Posts: 13
    • View Profile
Benchmark : SDL vs SFML
« Reply #3 on: September 07, 2007, 04:32:49 pm »
I'd run the test 3 times in a row. The result is from the last test.

My Machine
Quote
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


Result
Quote
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

Pwndja

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Getting on board with editing SFML to make it faster
« Reply #4 on: September 09, 2007, 03:20:52 am »
Hi I was wondering if I could help with the development of SFML? I am very interested in making it faster. I like that it is faster than SDL, which is the gaming lib that I was using until I found SFML. O by the way when using the dynamic DLLs for audio in VS it crashes after the program exits... I think you already talked about it in another form post but I'm not sure... just thought i would mention that...

let me know if I can help develop SFML I am a Junior in college taking a course now on Operating Systems and have had around 6-7 years programming experience.

thanks

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Benchmark : SDL vs SFML
« Reply #5 on: September 09, 2007, 11:04:19 am »
Hi

I currently don't need much help to develop the core libraries. However, if you are interested in porting it to a new operating system or language, it would be very helpful.

About the audio crash, it's already fixed for the next release.

Thanks
Laurent Gomila - SFML developer

Henrik.Flink

  • Newbie
  • *
  • Posts: 21
    • View Profile
Benchmark : SDL vs SFML
« Reply #6 on: September 09, 2007, 11:43:58 am »
My Machine
Quote
AMD Athlon 64 X2 Dual Core 6000+ 3.00GHz
2 GB DDR2-800 Ram
GeForce 8800GTS
MSI Motherboard with nForce 560
Windows Vista


Result
Quote

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

Srejv

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Benchmark : SDL vs SFML
« Reply #7 on: September 10, 2007, 11:15:34 am »
Isn't there some way to optimize dynamic text? Or are strings too slow to begin with?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Benchmark : SDL vs SFML
« Reply #8 on: September 10, 2007, 11:28:19 am »
Dynamic text can be optimized if needed.
Laurent Gomila - SFML developer

FallingSky

  • Newbie
  • *
  • Posts: 5
    • View Profile
Benchmark : SDL vs SFML
« Reply #9 on: October 11, 2007, 05:47:14 pm »
Im porting over a project of mine from SDL to SFML which involves almost nothing but dynamic text.  The FPS gets very low on my machine using SDL so I was wondering if you could take into consideration optimizing dynamic text?  I would greatly appreciate it but theres no rush!

Thanks

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Benchmark : SDL vs SFML
« Reply #10 on: October 12, 2007, 03:19:10 am »
It would first be interestring to see how much FPS you can get without further optimization. If it's really too low, I'll try to make it a priority.
Laurent Gomila - SFML developer

skylen

  • Newbie
  • *
  • Posts: 3
    • View Profile
Update SDL vs SFML benchmark to work w/ newer SFML builds
« Reply #11 on: May 07, 2008, 09:38:17 pm »
I have updated Laurent's benchmark to work with newer SFML builds. This one was made to work with and tested against SFML svn rev 651 (2008-05-03 15:05:43 -0700). I have here a patch against Laurent's ZIP file and a source tarball of my own. I added a Makefile for Linux (builds into a "bin/" subdirectory) and fixed the name of an SDL include file that had incorrect case (but worked on case-insensitive filesystems).

Patch (including bzr merge directive and bundle):
http://gibibit.com/upload/bench-sdl-sfml-update-20080507.patch

Source tarball:
http://gibibit.com/upload/bench-sdl-sfml-update-20080507.tar.bz2

Bazaar VCS (bzr) repository tarball:
http://gibibit.com/upload/bench-sdl-sfml-repo.tar.bz2

-Colin

JDieskau

  • Newbie
  • *
  • Posts: 6
    • View Profile
Benchmark : SDL vs SFML
« Reply #12 on: May 12, 2008, 12:53:35 pm »
Benchmark: 20080507
SFML Version: latest svn
SDL: 1.2.11

My maschine:
Quote
AMD Athlon 64 X2 Dual Core 6000+ 3.00GHz
2 GB DDR2-800 Ram
GeForce 8500GT
Ubuntu Linux ( 2.6.22-14-generic )


Result:
Quote
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

Hnefi

  • Newbie
  • *
  • Posts: 1
    • View Profile
Benchmark : SDL vs SFML
« Reply #13 on: May 14, 2008, 09:55:42 am »
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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Benchmark : SDL vs SFML
« Reply #14 on: May 14, 2008, 03:47:01 pm »
Quote
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.

I perfectly know that, this benchmark is basically just for beginners who might not be aware of the technical details, and wonder how SFML compares to a well known multimedia library.
At first I didn't want to do this benchmark, I did it only to answer the several requests I got from users.

Quote
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.

I don't think so. OpenGL with GLUT, SFML or SDL will just be OpenGL ; in this case the library is used only to create a valid context, there's nothing to benchmark after initialization other than OpenGL calls.

This benchmark also demonstrates that it's possible to use only SFML for 2D rendering, there's no need for mixing with OpenGL like with SDL. SFML is a truly usable 2D API, it's not just there for prototyping.
Laurent Gomila - SFML developer

 

anything