[SDL] Xtreme Labyrinth Beta 4

Ryan Westphal ryanw at csh.rit.edu
Fri Jul 12 20:43:01 PDT 2002


On Sat, 29/06/2002 19:09:37 , Matthias <matthias at zislers.de> wrote:
>Hi
>this is my initial mail in this list :-)
>and I want to know, is there a signals and slots concept
>in SDL or is there some other free portable sig & slo lib?
>
>I think such one is essential
>for a fluent gameplay, because searching all the time through lists may
>decrease the performance.

Well, unless you're getting *hundreds* of events per frame, it makes no sense to worry about switch() decoding overhead. I can't see how it could possibly take more than a few tens of cycles to decode an entire SDL message with arguments.

Also note that if you just sort the cases in your switch()es, there will be a single test and a branch-by-table. No compiler I know of will generate switch() code that searches through any form of structure, ever. An if() chain would be the worst possible result, and that only happens when the case values cannot be used to index a jump table.

Anyway, if switch() overhead really is an issue for you, a signal/slots system is definitely the *last* thing you want. The function call overhead will eat you alive. Also forget about using a normal operating system; Most events you receive will at the very least have travelled through an interrupt handler, a thread safe kernel/user space "gateway" (the "driver API"), and one or more user space libraries.


//David


.---------------------------------------
| David Olofson
| Programmer
| david.olofson at reologica.se
|---------------------------------------
| Address:
| REOLOGICA Instruments AB
| Scheelevägen 30
| 223 63 LUND
| Sweden
|---------------------------------------
| Phone: 046-12 77 60
| Fax: 046-12 50 57
| Mobil: 
| E-mail: david.olofson at reologica.se
| WWW: http://www.reologica.se
| 
`-----> We Make Rheology Real





More information about the SDL mailing list