Is X slow ? Why ?

Is X slow ? Why ?

Post by Arun Sharm » Mon, 02 Nov 1998 04:00:00



After using NT for a while at work, I feel that GUI applications
written on NT are more responsive than their counterparts on X on the
same hardware.

Since this could be a misconception created due to the fact that there
are a lot of nicely written apps on NT and the lack of them on Linux,
I wanted to convince myself that this is really the case.

I did some profiling using a tool that samples the pid and the IP at
each timer interrupt. So the data being presented here is only
statistical and might be erroneous.

I have an "average" Linux machine - a 200 MHz PPro and a S3 Virge
card, running Redhat 5.1 XF86_S3V version 3.3.2-8.

I had a typical Linux xsession running - fvwm2, fvwm2-taskbar, emacs,
netscape and rxvt. The (rather unscientific) benchmark that I ran was,
maximizing and minimizing emacs and netscape alternately for about 45
secs.

Here's the data:

Total samples: 4509
kernel (idle thread + interrupt handling)       - 2926
X                                               - 1504
fvwm2                                           - 20
fvwm2 taskbar                                   - 7
rxvt                                            - 1
emacs                                           - 8
netscape                                        - 43

The breakdown of the X server samples: 1444 samples in the userlevel
and the rest in system calls.

Most Xserver benchmarks that I've seen measure the drawing
capabilities of the X server (no of rectangles, triangles per sec
etc). I think given the current state of hardware, X drawing
performance is adequate.

The primary issue then is _latency_. It directly determines the
productivity of the user, because she can't proceed till the GUI
responds to the current input event.

Luckily, just 3 samples from the kernel space were in the mouse
interrupt handler. So I followed the events from the mouse handler and
here's how they go:

(Note: given a clock of 100 HZ, each sample = 0.01 sec)

nsamples        process
1               mouse interrupt
1               idle thread
13              X server
1               idle thread
19              X server
23              idle thread
1               fvwm2 taskbar
1               X server
34              idle thread
4               Xserver
1               fvwm2
6               X server
1               fvwm2
1               X server
3               netscape
5               X server
1               netscape
5               X server
1               fvwm2

[rest deleted]

In other words, there was a delay of 107 clock ticks (~ 1 sec) between
the time mouse was clicked on the fvwm2 task bar on the netscape tab
(guessed by looking at the sequence of events) and netscape even got a
chance to execute.

I think this is what makes X "feel" slower than the windows
GUI. Looking at the statistics, it looks like the window manager does
short bursts of work, but the 3 way switch between the window manager,
X server and the app is expensive.

Note that I didn't see any samples in the kernel context switch code
(infact, there wasn't even one -- which means that the context switch
happens much faster than the sampling granularity = 0.01 sec), but
time seems to be lost when one process blocks and another process
unblocks.

So that brings me back to one of my favorite (potentially stupid)
ideas - to make the window manager a shared library which runs in the
same address space as the X server. My knowledge of X is quite
superficial, so I leave it to to the people who know better to use
this data to do the "right" thing.

I also hold the opinion that, Linux needs usable GUI apps more than
high performance GUI apps. So time is better spent working on
GNOME/KDE than tweaking the performance of X.

If someone wants to investigate this further, please get in touch with
me.

        -Arun

 
 
 

Is X slow ? Why ?

Post by Todd Knar » Mon, 02 Nov 1998 04:00:00



Quote:> After using NT for a while at work, I feel that GUI applications
> written on NT are more responsive than their counterparts on X on the
> same hardware.

That's odd, having used NT and Linux/X11, I find that X11 on my Pentium 133
with a PCI S3 968 video card is snappier than an NT PII 266 with S3 Trio64
video on the motherboard. On the NT system I can actually _see_ the windows
as they are being drawn, which is pathetic.

Quote:> In other words, there was a delay of 107 clock ticks (~ 1 sec) between
> the time mouse was clicked on the fvwm2 task bar on the netscape tab
> (guessed by looking at the sequence of events) and netscape even got a
> chance to execute.

This is probably a bad test. Remember that netscape has to be loaded
into memory before it can begin to execute, and netscape is a rather
large ( navigator is a 7 megabyte executable, communicator is over 10
megabytes ) program. It takes it a second or two just to load into memory
on my system. Your latency here is probably exactly that: the time needed
to load netscape into memory before transferring control to it.

--
Don't worry about where to land -- by the time you get to it, it
_will_ be flat.
                                -- concering Orion landing procedures

 
 
 

Is X slow ? Why ?

Post by Arun Sharm » Mon, 02 Nov 1998 04:00:00



         > In comp.os.linux.development.system Arun Sharma

        >> After using NT for a while at work, I feel that GUI
        >> applications written on NT are more responsive than their
        >> counterparts on X on the same hardware.

         > That's odd, having used NT and Linux/X11, I find that X11
         > on my Pentium 133 with a PCI S3 968 video card is snappier
         > than an NT PII 266 with S3 Trio64 video on the
         > motherboard. On the NT system I can actually _see_ the
         > windows as they are being drawn, which is pathetic.

As I said in the earlier posting, drawing performance is not the
bottleneck. Given plenty of memory, NT can perform at acceptable
levels.

My claim is that NT/Win9x GUI feels faster because of the low
latency.

        >> In other words, there was a delay of 107 clock ticks (~ 1
        >> sec) between the time mouse was clicked on the fvwm2 task
        >> bar on the netscape tab (guessed by looking at the sequence
        >> of events) and netscape even got a chance to execute.

         > This is probably a bad test. Remember that netscape has to
         > be loaded into memory before it can begin to execute, and
         > netscape is a rather large ( navigator is a 7 megabyte
         > executable, communicator is over 10 megabytes ) program. It
         > takes it a second or two just to load into memory on my
         > system. Your latency here is probably exactly that: the
         > time needed to load netscape into memory before
         > transferring control to it.

I can confirm that this is not the case. My machine has plenty of
memory and the resident set size (RSS) of netscape didn't change
before and after the experiment.

Plus, I didn't see any samples in the kernel paging routines or the
disk driver.

        -Arun

 
 
 

Is X slow ? Why ?

Post by Todd Knar » Mon, 02 Nov 1998 04:00:00



Quote:> As I said in the earlier posting, drawing performance is not the
> bottleneck. Given plenty of memory, NT can perform at acceptable
> levels.

Again, I find that contrary to what I see. NT, even with huge amounts of
memory, does not draw as well on equivalent hardware as XFree86 does. And
X windows performance on my systems is more determined by the video card
than by other hardware, given reasonable hardware ( eg. Pentium 133, decent
IDE hard drives, 64megs of RAM to keep paging and swapping nonexistent ).

Quote:> I can confirm that this is not the case. My machine has plenty of
> memory and the resident set size (RSS) of netscape didn't change
> before and after the experiment.

Oddly enough, using both olvwm ( my usual window manager ) and fwvm2 on
my system ( a far slower one that yours ), netscape and emacs minimize and
restore almost instantaneously. The number of samples you get in your X
server does bother me, though. I find that, unless a program is actually
drawing on the screen, the X server on my system doesn't run that much.
Are you sure you don't have a CPU-hog running, or something that is doing
a lot of X11 interaction and keeping the server busy? Also, the fact that
you're using the older S3V server rather than the newer support in the SVGA
one might be affecting things. The newer one is probably capable of taking
advantage of more of the hardware acceleration, which as I noted above makes
a _big_ difference.

--
Don't worry about where to land -- by the time you get to it, it
_will_ be flat.
                                -- concering Orion landing procedures

 
 
 

Is X slow ? Why ?

Post by David F » Mon, 02 Nov 1998 04:00:00



> Luckily, just 3 samples from the kernel space were in the mouse
> interrupt handler. So I followed the events from the mouse handler and
> here's how they go:

> (Note: given a clock of 100 HZ, each sample = 0.01 sec)

> nsamples   process
> 1          mouse interrupt
> 1          idle thread
> 13         X server
> 1          idle thread
> 19         X server
> 23         idle thread
> 1          fvwm2 taskbar
> 1          X server
> 34         idle thread
> 4          Xserver
> 1          fvwm2
> 6          X server
> 1          fvwm2
> 1          X server
> 3          netscape
> 5          X server
> 1          netscape
> 5          X server
> 1          fvwm2

> [rest deleted]

> In other words, there was a delay of 107 clock ticks (~ 1 sec) between
> the time mouse was clicked on the fvwm2 task bar on the netscape tab
> (guessed by looking at the sequence of events) and netscape even got a
> chance to execute.

Won't these threads frequently relinquish the thread if they block
before they use up their 10 milliseconds?  Is there really a 1.07
second delay here?
--
David Fox           http://hci.ucsd.edu/dsf             xoF divaD
UCSD HCI Lab                                         baL ICH DSCU
 
 
 

Is X slow ? Why ?

Post by Itai Nahsho » Tue, 03 Nov 1998 04:00:00



> a lot of X11 interaction and keeping the server busy? Also, the fact that
> you're using the older S3V server rather than the newer support in the SVGA
> one might be affecting things. The newer one is probably capable of taking
> advantage of more of the hardware acceleration, which as I noted above makes
> a _big_ difference.

The newer driver in SVGA is faster but it does not support all S3 chips.
The older S3 and S3V servers were left as a choice for S3 chips which
are
not supported yet (or are buggy) in the SVGA driver.

Itai
--


 
 
 

Is X slow ? Why ?

Post by Mark Vojkovi » Tue, 03 Nov 1998 04:00:00



>The primary issue then is _latency_. It directly determines the
>productivity of the user, because she can't proceed till the GUI
>responds to the current input event.

[...]

Quote:

>In other words, there was a delay of 107 clock ticks (~ 1 sec) between
>the time mouse was clicked on the fvwm2 task bar on the netscape tab
>(guessed by looking at the sequence of events) and netscape even got a
>chance to execute.

>I think this is what makes X "feel" slower than the windows
>GUI. Looking at the statistics, it looks like the window manager does
>short bursts of work, but the 3 way switch between the window manager,
>X server and the app is expensive.

>Note that I didn't see any samples in the kernel context switch code
>(infact, there wasn't even one -- which means that the context switch
>happens much faster than the sampling granularity = 0.01 sec), but
>time seems to be lost when one process blocks and another process
>unblocks.

  The fact that I can run Geomview in a window and spin 3D shaded
geometric objects interactively with the mouse at something like 30
frames per sec. would seem to indicate that such a latency is not
a necessity.

  In the Geomview example, Geomview handles the mouse event,
rotates it's matrix, computes all the new verticies, renders the
scene, calls XShmPutImage, the server takes the data and sticks
it on the screen, all at 30 fps.  Obviously handling the mouse
events doesn't take 1 second.

  I think the latency you experience is probably a "feature"
of your window manager and the blocking is due to fwwm sleeping
or something.  It incorporates delays into several "click" related
operations and may be calling usleep to do it (see AutoRaise
in the fvwm man page).

Quote:

>So that brings me back to one of my favorite (potentially stupid)
>ideas - to make the window manager a shared library which runs in the
>same address space as the X server. My knowledge of X is quite
>superficial, so I leave it to to the people who know better to use
>this data to do the "right" thing.

  Implementing a window manager as an extension to the X-Server
is probably feasible, however, I think it would probably slow
things down rather than speed them up.  The latency shouldn't
really be a problem and making the window manager part of the server
would eliminate the chance of the XServer getting some work
done while the window manager was sleeping.

                                MArk.

 
 
 

Is X slow ? Why ?

Post by Matt Grossma » Tue, 03 Nov 1998 04:00:00



> After using NT for a while at work, I feel that GUI applications
> written on NT are more responsive than their counterparts on X on the
> same hardware.

[chop chop]

You do know that NT increases the priority of foreground applications
by default?  You can turn this off somewhere in "Control Panel", IIRC.
It might explain something...

Quote:> So that brings me back to one of my favorite (potentially stupid)
> ideas - to make the window manager a shared library which runs in the
> same address space as the X server. My knowledge of X is quite
> superficial, so I leave it to to the people who know better to use
> this data to do the "right" thing.

Linux does context switching pretty fast; I don't think you would gain
much by building the window manager into the server.  And what about
remote display?  Suppose you want to run a different window manager?
Etc.  IMHO it's a lot of effort for a small gain.

I have seen X terminals that have a "local" window manager, I don't know
how they implemented that but I suspect it was just a separate program.

Matt Grossman

http://www.oz.net/~mattg

 
 
 

1. SCO 5.0.2 NSF is slow - VERY slow What am I doing wrong??

I have two machines with OpenServer 5.0.2 connected by TCP/IP.  rcp works,
rlogin works, telnet works, and ftp works.  But when I tried to experiemnt with
nsf I found out that it is slow - very slow.  

This is my PCs' specs.

pasta (pasta.takadom.org) 134.1.1.2
Pent-75
1.6GB/32MB
SMC 8432BT
/etc/exports
/u

sushi (sushi.takadom.org) 134.1.1.1
586-133
2.5GB/16MB
Intel EtherExpress 16
/etc/exports
/v

On sushi, I login as root and type "mount pasta:/u /usr/takakami/tempmount"

Response:
WARNING: NFS server pasta not responding, still trying
WARNING: NFS server pasta ok

#

This takes 5 minutes.  (from my command to getting a prompt back)

mount
/on /dev/root read/write on ******
/stand on ****************
/u on *********************
/v on ********************
/usr/takakami/tempmount on pasta:/u read/write on ******************

This is immediate.  

Then I do
cd/usr/takakami/tempmount

I go get my coffee, pick up my laundries.....  10 minutes later I get
#

Then I do l

Response
WARNING: NFS server pasta not responding, still trying
WARNING: NFS server pasta ok
WARNING: NFS server pasta not responding, still trying
WARNING: NFS server pasta ok

10 minutes later, I hit {del} to abort
#

After setting up tcp/ip to be able to do rcp, rlogin, telnet, ftp, the only
file I changed (added) was /etc/exports file.

I verified mountd, nfsd, pcnfsd, and biod was running.  Accroding to several
past posts, nfs get defined default when one install OpenServer 5.0.2.

What am I doing wrong here?  

The situation is similar the other way around (trying to nfs mount /v on sushi
from pasta)

Thanks!

2. Checking fs: lose/lose situation...

3. Why are slow window managers and desktops slow?

4. sbrk, malloc and gcc (2.6.0) in SunOS 4.1.3

5. Why is find so slow (Re: Why use find?)

6. 'dead' sockets in UNIX

7. Accuracy of Netmechanic Server Check--Am I slow?

8. sftp not defined

9. FTP Slow to Connect - And I am pretty sure my reverse DNS is working

10. Why am I not 'Logged in' ?

11. Tin newsreader, slow slow slow

12. Why I am getting two IP addresses when I connect to my work through VPN

13. Why I am glad I know perl