[Xcb] Is XCB's asynchronous mode necessary for a Window Manager?

Peter Harris git at peter.is-a-geek.org
Mon Oct 12 06:10:15 PDT 2009

On Mon, Oct 12, 2009 at 5:11 AM, Chengqi Song wrote:
> According to XCB's document (http://xcb.freedesktop.org/tutorial/), the main
> improvement of XCB is to reduce the time spent in multiple round trip time into
> one. But for a window manager:
> 1. the number of sequential operations is not large, so the number of RTT is not
> large,

Really? When mapping a window, you can expect at least a dozen round
trip operations (mostly to get properties, but also querying geometry
and etc).

I think that counts as large.

> 2. RTT in a local machine is very short, it's only larger when connecting a
> remote X client,

Not as short as you may think. On a uniprocessor, it costs at least a
pair of context switches. On multi-processor, it might cost a few
cache ping-pongs instead, which isn't much better.

When I rewrote xlsclients to use XCB instead of Xlib, I saw a roughly
sevenfold speedup on a local machine. The benefits of not waiting for
a round-trip are even greater over a slow network, yes, but don't
discount the benefits on a local machine.


Also, there are many thousands of people who run their entire desktop
remotely every day (XDMCP). Please don't make the mistake of thinking
that nobody runs a window manager remotely.

> so I think RTT is not a critical bottleneck for a window manager. On the other
> side, XLib provides more higher level operations than XCB, so it's easier to
> build a window manager basing on xlib than xcb, less lines of source code at
> least.

Xlib isn't that much higher level than XCB. If you had said GTK (or
Qt, or even Motif), you would have had a good point.

Peter Harris

More information about the Xcb mailing list