Subject: | SDL::App loop() very slow |
SDL::App's loop() method calls sync() every time around the event loop,
for non-hardware based surfaces, such as an X window this noticably lags
event processing if you're handling events such as mouse movements for a
drag.
I spent a couple of hours trying to track down performance issues in my
code until I noticed the sync() in loop().
Ideally the sync would only happen when the event queue was empty, or
only periodically.
A note in the loop documentation would also work:
--- lib/SDL/App.pm.orig 2006-01-10 15:19:43.000000000 +1100
+++ lib/SDL/App.pm 2006-01-10 15:41:17.000000000 +1100
@@ -302,6 +302,10 @@
of event handler subroutines. The keys of the hash must be SDL event
types such
as SDL_QUIT(), SDL_KEYDOWN(), and the like. The event method recieves
as its parameter
the event object used in the loop.
+
+loop() calls sync after processing every event. This may result in
+performance issues.
+
Example:
--- lib/SDL/App.pm.orig 2006-01-10 15:19:43.000000000 +1100
+++ lib/SDL/App.pm 2006-01-10 15:41:17.000000000 +1100
@@ -302,6 +302,10 @@
of event handler subroutines. The keys of the hash must be SDL event types such
as SDL_QUIT(), SDL_KEYDOWN(), and the like. The event method recieves as its parameter
the event object used in the loop.
+
+loop() calls sync after processing every event. This may result in
+performance issues.
+
Example: