Re: CLX/CMUCL: Event processing speed
- From: Ulrich Hobelmann <u.hobelmann@xxxxxx>
- Date: Mon, 12 Dec 2005 10:36:07 +0100
David Trudgett wrote:
Hm, it's been a while since I did any X window. Wasn't there an event count associated with each sort of event. I remember reading something about that if some count > 0, you simply discard the event, so that you only redraw after the last resize/expose/... was received.
I thought I was doing that, but I looked at the code and realised I must have accidentally deleted it somewhere along the line. In any case, I put it back in, but the behaviour is just the same. I assume it must be generating lots of exposure events with count equal to zero.
Hm, maybe you should stick a FORMAT or a counter somewhere in there, or something that measures the time between subsequent events of a kind.
I just looked through the Xlib code I wrote (in C), and noticed that you don't have any ConfigureNotify-events in there. They are the ones that contain resizing information about your window.
(from Xlib.h)
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window event;
Window window;
int x, y;
int width, height;
int border_width;
Window above;
Bool override_redirect;
} XConfigureEvent;
I only used width and height for a simple example, but window might be interesting too if you have more than one. Unfortunately I'm not exactly familiar with CLX, so I can't tell what exactly is going on in your code.
I'm not sure what modern window-managers do; if they really send lots of expose-events, or mostly configure-notifies. In any case it shouldn't be *that* many.
Anyway, here is the corrected bit:
(defmacro with-drawing-window (&body body)
(flet ((do-stuff () `(progn ,@body (display-finish-output *display*))))
`(unwind-protect (progn
(show-drawing-window)
(event-case
(*display* :force-output-p t :discard-p t)
What do force-output-p and discard-p do? Maybe this is some kind of Sync option that slows down the server connection?
(DRAW-LINE *DRAWING-WINDOW*
*GRAPHICS-CONTEXT*
100
300
X
Y2)
(WHEN (>= X 590) (SETQ X-INC (- X-INC))))
(DISPLAY-FINISH-OUTPUT *DISPLAY*)))
XSync()?
At least in the C version, all the X-commands you do are placed in a buffer, and only XNextEvent() flushes the buffer to the server, goes fetch new events, and gives you the first one. Subsequent XNextEvents probably don't even make new round-trips (at least when you don't create new commands for the server; and probably your resize-handlers, and the expose-handler with count > 0 won't do that), but just fetch the next event in the client's buffer.
(so in C you almost never need to call anything like XSync(). Not sure what your DISPLAY-FINISH-OUTPUT does.)
Not sure what takes so long here...
-- If you have to ask what jazz is, you'll never know. Louis Armstrong .
- Follow-Ups:
- Re: CLX/CMUCL: Event processing speed
- From: David Trudgett
- Re: CLX/CMUCL: Event processing speed
- References:
- CLX/CMUCL: Event processing speed
- From: David Trudgett
- Re: CLX/CMUCL: Event processing speed
- From: Ulrich Hobelmann
- Re: CLX/CMUCL: Event processing speed
- From: David Trudgett
- CLX/CMUCL: Event processing speed
- Prev by Date: Re: SBCL on Windows
- Next by Date: Re: REGEXPS
- Previous by thread: Re: CLX/CMUCL: Event processing speed
- Next by thread: Re: CLX/CMUCL: Event processing speed
- Index(es):
Relevant Pages
|