Re: Snappy GUI response

Keith Packard <[email protected]>
Newsgroups gmane.comp.xfree86.forum
Message-ID <E19YCHx-0001zB-00@localhost>
Around 16 o'clock on Jul 3, Owen Taylor wrote:

> * Modern toolkits in my experience make far less roundtrips 
>   than older toolkits like, say, Motif. I don't think "too
>   many roundtrips" is the answer. Modern toolkits are slower
>   than old toolkits, and they *should* be slower than old
>   toolkits because they do vastly more.

I have some measurements of what modern toolkits are doing on the wire:

	http://keithp.com/~keithp/talks/usenix2003/

This shows that applications are still doing numerous round trips that 
could be avoided, but they're doing a lot better than Motif ever did.  The
essential changes are:

 1)	TrueColor pixel allocation is now done client-side.  Netscape
	was notorious for allocating hundreds of pixel values one at a time
	at startup time; modern toolkits are optimized for TrueColor 
	visuals where pixel values can be directly computed from colors.

 2)	Client-side fonts.  This eliminates numerous round trips to list
	available fonts and query font information.

That's the good side -- the bad side is that more capabilities mean more 
work, and some of that work involves round trips which could be optimized 
away:

 1)	InternAtom -- Qt interns a bunch of atoms at startup time in
	one round trip; Gtk+ doesn't bother.  That's actually a significant
	time savings.

 2)	Extensions.  Each extension takes at least two round trips to 
	initialize.

 3)	GetGeomtry.  Applications are curious about where windows are and
	the ICCCM doesn't give them enough information about borders and 
	such.  Mozilla spends a lot of time asking where its windows are
	on the screen.

While you might think all of these are irrelevant in a non-networked 
environment, the fact is that any context switch, whether across a 
network, between two processes or between a process and the kernel takes  
time.  Batching operations between context switches is a good idea in all 
environments, and that's where X can actually *beat* kernel window systems 
that have very little batching available.

The only X server graphics operation which has any noticeable effect on 
2D application performance is screen->screen copies -- nothing else even 
shows up on the radar in any objective system-wide measurements I've done.

-keith
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.