[Gambas-user] sdl Draw event overhead is killing frame rate
Benoît Minisini
gambas at ...1...
Thu Jan 16 22:40:12 CET 2014
Le 16/01/2014 06:03, Kevin Fishburne a écrit :
>
> The results are in, and they don't tell me much. :( I attached the
> updated test project, which includes the test results in comments at the
> top. They are:
>
> ' No Stop Event | No Geometry | Binary NVIDIA driver | 236 FPS
> ' Stop Event | No Geometry | Binary NVIDIA driver | 158 FPS
> ' No Stop Event | No Geometry | Nouveau driver | 238 FPS
> ' Stop Event | No Geometry | Nouveau driver | 159 FPS
> ' No Stop Event | Geometry | Binary NVIDIA driver | 236 FPS
> ' Stop Event | Geometry | Binary NVIDIA driver | 155 FPS
> ' No Stop Event | Geometry | Nouveau driver | 218 FPS
> ' Stop Event | Geometry | Nouveau driver | 161 FPS
>
> Adding "Stop Event" reduces thread CPU usage from 100% to 84%. The frame
> rate is consistently lower when using Stop Event. That 16% difference in
> CPU also doesn't seem to correlate with the difference in frame rates,
> as the frame rate difference has a significantly larger discrepancy.
> Factors unknown to me could be contributing to that of course...
It's actually simple: when 'Stop Event' is used, the process is paused
during a little delay (about 10 ms according to the SDL_Delay function
documentation). So it acts as a frame rate limitation.
If you don't use 'Stop Event', there is no such delay. But you get in
both cases a call to the Gambas event loop with a 10 ms timeout (yes, 10
ms again. This is usually the smallest delay a Linux Kernel can handle).
That means if there is no Gambas event to process, the process is paused
during 10 ms. If there is a Gambas event to process, there is no pause.
I will try to remove all this delays, and you will tell me if it helps you.
--
Benoît Minisini
More information about the User
mailing list