[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CLX Speed: Pretty poor



    Date: Tue, 13 Jun 89 12:43:53 CDT
    From: oren@stroke.csc.ti.com (LaMott Oren)

       Date: Tuesday, 13 June 1989 12:21:03 EDT
       From: Brad.Myers@a.gp.cs.cmu.edu

       We ran some tests to see how fast CLX is, and it isn't.    Compared to
       calling the X routines from C, CLX is **approximately 15 times slower**
       (1500% slower).  This is running the standard CLX under CMU CommonLisp
       on IBM RTs with X11R3.  My impression is the Lucid CLX is not faster (and
       may be even slower).  

    The C and Lisp codes are NOT equivalent.  The inner loop of the C code calls
    XFillRectangle followed by XFlush.  The inner loop of the Lisp code calls
    draw-rectangle (which IS equivalent) followed by display-finish-output (which
    is equivalent to XSync).  Therefore, the Lisp code is doing a server round-trip
    for every rectangle!!

Actually, that's not all.

There is the evidently gratuituous difference in the size and position
of the windows which makes comparison difficult.  There is the lack of
DEFVAR's for the globals in the LISP, which makes compilation noisy.
There is the lack of a cast of CopyFromParent to a (Visual *) required
by ANSI compilers (CopyFromParent being just 0).

But most significantly, the C code draws twice as many rectangles.  It
draws one in white at the old position.  The LISP code only draws in
black in the new position.  No doubt the unjustified differences
mentioned above and the inconsistent use of macros make it hard to spot
this until you run them both.

    I'm sure it's faster on a Lisp machine (TI Explorer or Symbolics)

As submitted, the LISP runs about 1.5 times faster, since it has less
work to do!  When you correct that, they run about the same on an Ivory.

The actual numbers aren't really meaningful, since the server I used
happened not to be on the same processor.  But the client communications
path was the same.