Re: very slow drawing

From: Fons Rademakers (rdm@pcsalo.cern.ch)
Date: Sun Feb 07 1999 - 02:43:12 MET


Hi Pasha,

   ROOT does not send pixmaps over the network. If we really would do 
that it would be way slower. Every object is drawn using basic (vector)
draw commands (XDrawLine, XFillRectangle, etc.).

Here is what really happens:

  - All graphics are drawn in off-screen pixmaps. Pixmaps are server 
    side objects. To create a pixmap only a few parameters need to be 
    send over the wire (width, height, depth, display, etc.)
    This takes hardly any bandwidth. 

  - Every TPad, and derivatives like TButton, have their own associated 
    pixmap.

  - Every TCanvas has an associated pixmap and a window. The window is
    what is visible on the screen.

  - When a TCanvas is updated (TCanvas::Update()), all pixmaps of the
    TPads belonging to the canvas are copied to the canvas' pixmap and
    finally the canvas' pixmap is copied to the canvas' window. 
    Telling the server to copy pixmaps is a very small message (source 
    pixmap id, destination pixmap id, x, y, w, h, etc.). Besides, the X
    protocol buffers messages and sends them in batches.

  - Using off-screen pixmaps allows smooth (flicker free) graphics
    updates in the canvas (you never see an object being erased and
    redrawn).

  - Using off-screen pixmaps for TPad's facilitates the pad "window
    management" since no complicated overlap calculations have to be
    made. Copying the TPad pixmaps in their stacking order gives the
    desired result.
   
  - However, using off-screen pixmaps is relatively heavy on the memory
    usage in the X server and therefore X terminals with little memory
    don't particularly like ROOT canvases with many pads.

  - The thing that slows down ROOT graphics is that we (still) use (too)
    many round-trip X commands (querying pixmap attributes, cursor shape 
    changes when moving the mouse, etc.). It is not so much the amount of
    data that is transfered as well a latency problem (in spite of the
    X command buffering). 

  - The higher level client-server graphics work we started is an 
    attempt to reduce the bandwidth and latency by providing a higher level
    graphics protocol. However, this effort is now in a dormant state due
    to lack of human resources.

  - PAW graphics is faster because very much simpler.

So to conclude, we probably can improve performance by carefully analyzing
the X traffic and to see if we can cache more information in ROOT (the client)
in order to reduce the traffic. On the otherhand, the ROOT graphics is not as 
fundamentally flawed as you did describe.


Cheers, Fons


> 
> It seems that this discussion raises a very important issue, related to the
> design of ROOT low-level graphics.
> 
> - ROOT uses raster (as opposite to vector) graphics, it is pixmaps and not 
>   X11 "draw primitive" commands which are being passed over the network.
>   Passing pixmaps over the network is not the most time-efficient way 
>   of displaying the graphics images. I think that this explains the problems 
>   experienced by Thomas. 
> 
>   It takes me 10 seconds and even more to redraw a simple canvas 
>   when I'm working from home using X-terminal over the modem (28K) connection.
>   In this mode there is a drastic difference in performance between ROOT 
>   and PAW graphics with PAW graphics being many (5-10) times faster.
>   Redrawing of more complex event displays takes minutes.
> 
> - any graphics system which is required to be efficient over the network has
>   to work in client-server mode with the drawing commands and not pixmaps
>   travelling across the ocean. If I remember it correctly a work on the 
>   implementation of client-server graphics mode for ROOT has started some 
>   time ago but I don't know where the things stand right now. Client-server
>   mode won't help people using X-terminals, but as these are becoming less 
>   and less popular, I don't think it is a serious issue.
>   
> - several big experiments (with Tevatron experiments among them) are planning 
>   to take data in the year of 2000, there definitely
>   be a lot of physicists using event display programs in the distributed
>   environment (over the LAN's and WAN's), the issue of performace is a very 
>   important one, so it make sense to have a special discussion of client-server 
>   graphics mode at the ROOT user workshop planned at Fermilab in the end of March.
> 
> 							-pasha
> 


-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:29 MET