Are SDL events slow?
I just added events to my game development environment that I am making. It's based around SDL and Ruby. After playing with some events code, I noticed that the CPU usage for the program increased by 3% (total). I thought this was a bit odd, I was a bit worried that it was the overhead of Ruby, but after digging around, it seems that it's the call to SDL_PollEvent.
Normally it takes far less than a millisecond to complete when there is no input, but when there is, the function can take 1-3ms to complete. Sometimes as high as 5ms.
Am I nuts? Can anyone else confirm this? That is really ridiculous. Spending 10% of the time in a frame waiting for SDL to process input is completely unacceptable.
Normally it takes far less than a millisecond to complete when there is no input, but when there is, the function can take 1-3ms to complete. Sometimes as high as 5ms.
Am I nuts? Can anyone else confirm this? That is really ridiculous. Spending 10% of the time in a frame waiting for SDL to process input is completely unacceptable.
Ive mesured fps and averaged it over the same amount of time (100 timings) with SDL events on and off in a simple OpenGL SDL game im writing.
I got 22.4 fps with events and 23.3 without events.
Except my event code is 64 lines long and deals with executing functions in a seperate script, but none of these events (mouse and keyboard were untouched) were called so that wont have affected the results.
<EDIT: I just noticed somthing funny, were both having speed problems with scriptable SDL games!
>
I got 22.4 fps with events and 23.3 without events.
Except my event code is 64 lines long and deals with executing functions in a seperate script, but none of these events (mouse and keyboard were untouched) were called so that wont have affected the results.
<EDIT: I just noticed somthing funny, were both having speed problems with scriptable SDL games!
>
Sir, e^iπ + 1 = 0, hence God exists; reply!
SDL's events are just Cocoa events... it seems a bit unlikely that they'd be that slow...
When I tested it, I disabled everything in my event loop but the call to poll events. The time taken was measured from Ruby, but if make the function call empty it drops down to microseconds.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Occlusion queries... SLOW. | TomorrowPlusX | 8 | 4,017 |
Aug 19, 2005 07:05 AM Last Post: TomorrowPlusX |
|
| SDL got pretty slow on Tiger? | Zeeke | 17 | 8,084 |
Jun 5, 2005 12:29 AM Last Post: Kevin Lindeman |
|
| Slow first time draw of textures | rzilibowitz | 4 | 3,200 |
Jan 17, 2005 01:46 AM Last Post: rzilibowitz |
|
| This thing = way too slow | LongJumper | 9 | 4,008 |
Dec 20, 2004 05:14 AM Last Post: TomorrowPlusX |
|
| Terribly slow :-( | CMagicPoker | 7 | 4,469 |
Jun 23, 2002 04:06 AM Last Post: CMagicPoker |
|

